Help us shape the future of Go! Take the 2026 Go Developer Survey

db

package
v2.0.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Mongo = &mongo.Mongodb{}
View Source
var Mysql = &mysql.MysqlClient{}
View Source
var Redis = redis.Redis
View Source
var Sqlite = &sqlite.Sqlite{}

Functions

func MySQLTx added in v2.0.12

func MySQLTx[T any](ctx context.Context, fn func(tx *gorm.DB) (T, error), dbName ...string) (T, error)

MySQLTx runs fn atomically on one MySQL connection. DAOs used by fn must be bound with WithTx(tx); otherwise they intentionally use their normal pool.

func TransactionOn added in v2.0.12

func TransactionOn[T any](ctx context.Context, conn *gorm.DB, fn func(tx *gorm.DB) (T, error)) (T, error)

TransactionOn executes a callback and rolls back on every callback error.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL