Versions in this module Expand all Collapse all v0 v0.6.1 Oct 19, 2026 v0.6.0 Oct 18, 2026 v0.5.5 Oct 17, 2026 v0.5.4 Oct 17, 2026 v0.5.3 Oct 17, 2026 v0.5.2 Oct 17, 2026 v0.5.1 Oct 17, 2026 v0.3.0 Oct 16, 2026 Changes in this version + func InTransactionContext(ctx context.Context, db *gorm.DB, fn TXFunc) error + func IsUniqueViolation(err error) bool + func Open(dialector gorm.Dialector, opts ...OpenOption) (*gorm.DB, error) + func OpenMySQL(cfg MySQLConfig) (*gorm.DB, error) + func PaginateScope(req *pagination.PageRequest) func(db *gorm.DB) *gorm.DB + type AuditModel struct + CreatedAt time.Time + CreatedBy int64 + DeletedAt gorm.DeletedAt + ID int64 + UpdatedAt time.Time + UpdatedBy int64 + func (m *AuditModel) GetID() int64 + func (m *AuditModel) SetID(id int64) + type AuditPlugin struct + UserIDFunc func(ctx context.Context) int64 + func NewAuditPlugin(userIDFunc func(ctx context.Context) int64) *AuditPlugin + func (p *AuditPlugin) Initialize(db *gorm.DB) error + func (p *AuditPlugin) Name() string + type BaseModel struct + CreatedAt time.Time + ID int64 + UpdatedAt time.Time + func (m *BaseModel) GetID() int64 + func (m *BaseModel) SetID(id int64) + type FilterBuilder struct + func NewFilterBuilder() *FilterBuilder + func (fb *FilterBuilder) Add(ok bool, sql string, args ...any) *FilterBuilder + func (fb *FilterBuilder) Apply(db *gorm.DB) *gorm.DB + func (fb *FilterBuilder) Clauses() (string, []any) + func (fb *FilterBuilder) IsEmpty() bool + type Logger struct + func NewDefaultLogger() *Logger + func NewLogger(config gormLogger.Config) *Logger + func (l *Logger) Error(ctx context.Context, msg string, data ...any) + func (l *Logger) Info(ctx context.Context, msg string, data ...any) + func (l *Logger) LogMode(level gormLogger.LogLevel) gormLogger.Interface + func (l *Logger) Trace(ctx context.Context, begin time.Time, ...) + func (l *Logger) Warn(ctx context.Context, msg string, data ...any) + type Model interface + GetID func() int64 + SetID func(id int64) + type MySQLConfig struct + ConnMaxLifeMin int + DBName string + Host string + MaxIdleConns int + MaxOpenConns int + Password string + Port int + User string + type OpenOption func(*openConfig) + func WithConnMaxIdleTime(d time.Duration) OpenOption + func WithConnectionPool(maxIdleConns, maxOpenConns int, connMaxLifetime time.Duration) OpenOption + func WithGormOptions(opts ...gorm.Option) OpenOption + type PageResponse = pagination.PageResponse[T] + func Paginate[T any](db *gorm.DB, req *pagination.PageRequest, queryFn func(db *gorm.DB) *gorm.DB) (*PageResponse[T], error) + type SingletonRepo struct + func NewSingletonRepo[T Model](db *gorm.DB, defaultVal func() T) *SingletonRepo[T] + func (r *SingletonRepo[T]) Get(ctx context.Context) (T, error) + func (r *SingletonRepo[T]) GetOrCreate(ctx context.Context) (T, error) + func (r *SingletonRepo[T]) Save(ctx context.Context, model T) error + type SoftDeleteModel struct + CreatedAt time.Time + DeletedAt gorm.DeletedAt + ID int64 + UpdatedAt time.Time + func (m *SoftDeleteModel) GetID() int64 + func (m *SoftDeleteModel) SetID(id int64) + type TXFunc func(tx *gorm.DB) error