Versions in this module Expand all Collapse all v1 v1.0.2 Apr 16, 2024 Changes in this version + const CallBackAfterName + const CallBackBeforeName + const GormSpanKey + const MySQL + const Postgresql + const SQLServer + const SQLite + const TiDB + func DBConnect(driver DriverName, dsn string, option options) (*gorm.DB, error) + func DBWhereExpression(column string, value any, symbol string) clause.Expression + type BasicRepo interface + Count func(ctx context.Context, expression ...clause.Expression) (count int64, err error) + Create func(ctx context.Context, ent *T) error + Creates func(ctx context.Context, ent []*T) error + Database func() Database + DeleteBy func(ctx context.Context, expression []clause.Expression) error + DeleteOne func(ctx context.Context, id uint) error + ExecTX func(ctx context.Context, fc func(ctx context.Context) error) error + Find func(ctx context.Context, expression ...clause.Expression) ([]*T, error) + FindOne func(ctx context.Context, id uint) (*T, error) + FindOneBy func(ctx context.Context, expression []clause.Expression) (*T, error) + Model func() *T + Update func(ctx context.Context, id uint, ent *T) error + UpdateColumns func(ctx context.Context, id uint, data any) error + UpdateColumnsBy func(ctx context.Context, expression []clause.Expression, data any) error + func NewBasicRepository[T any](database Database) BasicRepo[T] + type DB struct + func (d *DB) Close() error + func (d *DB) DB(ctx context.Context) *gorm.DB + func (d *DB) ExecTx(ctx context.Context, fc func(context.Context) error) error + func (d *DB) TranslateGormError(ctx context.Context, db *gorm.DB) error + type Database interface + Close func() error + DB func(ctx context.Context) *gorm.DB + ExecTx func(ctx context.Context, fc func(context.Context) error) error + TranslateGormError func(ctx context.Context, db *gorm.DB) error + func NewDataBase(driver DriverName, dsn string, opts ...Option) (Database, error) + type DriverName string + type ILike clause.Eq + func (like ILike) Build(builder clause.Builder) + func (like ILike) NegationBuild(builder clause.Builder) + type Limit struct + All bool + Count bool + PageNum uint + PageSize uint + type OpentracingPlugin struct + func (op *OpentracingPlugin) Initialize(db *gorm.DB) error + func (op *OpentracingPlugin) Name() string + type Option interface + func WithAutoMigrate(a bool) Option + func WithAutoMigrateDst(models []any) Option + func WithLogger(log logger.Interface) Option + func WithOpentracingPlugin(op *OpentracingPlugin) Option + func WithTablePrefix(s string) Option + func WithTranslateError(translateError translateErrorFc) Option