Documentation
¶
Index ¶
- func Connect(addr, user, pwd, dbName string, options ...Option)
- func DB(ctx context.Context) *gorm.DB
- func ExecuteInTx(ctx context.Context, ops ...TxOperation) error
- func IsRecordNotFoundErr(err error) bool
- func StartTransaction(ctx context.Context, trans TxOperation) error
- type Option
- type Options
- type TxOperation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteInTx ¶ added in v1.2.2
func ExecuteInTx(ctx context.Context, ops ...TxOperation) error
ExecuteInTx 批量执行事务
func IsRecordNotFoundErr ¶ added in v0.9.0
IsRecordNotFoundErr 判断是否记录不存在错误
func StartTransaction ¶
func StartTransaction(ctx context.Context, trans TxOperation) error
StartTransaction 开启事务
Types ¶
type Option ¶
type Option func(*Options)
func WithIgnoreRecordNotFoundError ¶
WithIgnoreRecordNotFoundError 忽略记录不存在错误
func WithParameterizedQueries ¶
WithParameterizedQueries 使用参数化查询
func WithSlowThreshold ¶
WithSlowThreshold 设置慢查询阈值
Click to show internal directories.
Click to hide internal directories.