db

package
v2.0.19 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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