Documentation
¶
Index ¶
- Variables
- func Conn() *gorm.DB
- func DB(ctx context.Context) *gorm.DB
- func OpenDedicatedSQLDB(applicationName string, maxOpenConns int) (*sql.DB, error)
- func PoolStats() (sql.DBStats, error)
- func RetryOnDeadlock(attempts int, operation func() error, wait func(attempt int)) error
- func TruncateTables() error
- func VerifyTestDatabase(db *gorm.DB) error
- type Config
- type DSNConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultStatementTimeout = 60 * time.Second DefaultIdleInTransactionSessionTimeout = 30 * time.Second )
Functions ¶
func DB ¶ added in v0.26.0
DB returns a request-scoped GORM handle so SQL trace hooks can attach to the active OpenTelemetry span in ctx.
func OpenDedicatedSQLDB ¶ added in v0.26.0
func RetryOnDeadlock ¶
func TruncateTables ¶
func TruncateTables() error
func VerifyTestDatabase ¶ added in v0.28.0
VerifyTestDatabase returns an error unless the connection points at a test database (name ending in _test). Call it before destructive test helpers so a misconfigured DB_NAME fails loudly instead of wiping a developer database.
Types ¶
type Config ¶
func LoadConfig ¶ added in v0.19.0
func LoadConfig() Config
Click to show internal directories.
Click to hide internal directories.