Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Mongo = &mongo.Mongodb{}
var Mysql = &mysql.MysqlClient{}
var Redis = redis.Redis
var Sqlite = &sqlite.Sqlite{}
Functions ¶
func MySQLTx ¶
func MySQLTx[T any](ctx context.Context, fn func(tx *gorm.DB) (T, error), dbName ...string) (T, error)
Transaction executes fn in a MySQL transaction and returns its result. The transaction is committed only when fn returns a nil error. Any error returned by fn, or by starting/committing/rolling back the transaction, is returned to the caller.
All database work performed by fn must use tx (or a DAO explicitly bound to tx); opening another connection inside fn is outside this transaction.
Types ¶
This section is empty.