Versions in this module Expand all Collapse all v0 v0.1.1 Nov 12, 2026 v0.1.0 Nov 12, 2026 Changes in this version + var ErrEventAborted = &Error + var ErrMigrationLocked = &Error + var ErrNotFound = &Error + var ErrPoolAcquireTimeout = &Error + var ErrUnsupportedFeature = &Error + func Sticky(ctx context.Context) context.Context + type Code string + const CastFailed + const ChecksumMismatch + const ConnectionFailed + const ConnectionNotFound + const DiffFailed + const EventAborted + const EventHandlerFailed + const InvalidConfig + const InvalidSchema + const LazyLoadingViolation + const MassAssignment + const MigrationFailed + const MigrationLocked + const MultipleRecords + const NotFound + const PoolAcquireTimeout + const ProductionBlocked + const PruneFailed + const QueryFailed + const RelationNotLoaded + const SeedFailed + const ShardFailed + const ShardNotFound + const UnboundModel + const UnknownMorphType + const UnsupportedDialect + const UnsupportedFeature + func CodeOf(err error) Code + type Config struct + ConnMaxLifetime time.Duration + DSN string + Dialect string + Gorm *gorm.Config + MaxIdleConns int + MaxOpenConns int + Pool Pool + ReplicaPolicy string + Replicas []string + type Conn interface + Exec func(ctx context.Context, query string) error + type DB struct + Dialect dialect.Dialect + Gorm *gorm.DB + func Adopt(g *gorm.DB, d dialect.Dialect) *DB + func Open(cfg Config) (*DB, error) + func OpenContext(ctx context.Context, cfg Config) (*DB, error) + func (d *DB) Close() error + func (d *DB) DisableQueryLog() + func (d *DB) EnableQueryLog() + func (d *DB) FlushQueryLog() + func (d *DB) Listen(fn func(QueryEvent)) (off func()) + func (d *DB) Name() string + func (d *DB) Ping(ctx context.Context) error + func (d *DB) QueryLog() []QueryEvent + func (d *DB) SetStrict(s Strict) + func (d *DB) ShouldBeStrict(on bool) + func (d *DB) Strictness() Strict + func (d *DB) Transaction(ctx context.Context, fn func(tx *DB) error) error + func (d *DB) WithGorm(g *gorm.DB) *DB + func (d *DB) WriteDB() *DB + type Error struct + Code Code + Err error + Field string + Message string + func Newf(code Code, format string, args ...any) *Error + func Wrap(code Code, cause error, format string, args ...any) *Error + func (e *Error) Error() string + func (e *Error) Is(target error) bool + func (e *Error) Unwrap() error + type Manager struct + func NewManager(def string, cfgs map[string]Config) (*Manager, error) + func (m *Manager) Close() error + func (m *Manager) Connection(ctx context.Context, name string) (*DB, error) + func (m *Manager) Default(ctx context.Context) (*DB, error) + func (m *Manager) Names() []string + func (m *Manager) Purge(name string) error + type Pool struct + AcquireTimeout time.Duration + AfterCreate func(ctx context.Context, conn Conn) error + IdleTimeout time.Duration + Max int + MaxLifetime time.Duration + Min int + Validate bool + type QueryEvent struct + Duration time.Duration + Err error + Rows int64 + SQL string + type Strict struct + LazyLoading bool + OnLazyLoad func(model, relation string)