Versions in this module Expand all Collapse all v1 v1.0.0 Nov 22, 2025 Changes in this version + var ErrValidation = errors.New("validation failed") + type AfterFinder interface + AfterFind func() error + type BeforeCreater interface + BeforeCreate func() error + type DB struct + func New(sqlDB *sql.DB, dialect Dialect) *DB + func NewWithLogger(sqlDB *sql.DB, dialect Dialect, logger Logger) *DB + func (db *DB) Create(ctx context.Context, model interface{}) error + func (db *DB) Delete(ctx context.Context, model interface{}) error + func (db *DB) Dialect() Dialect + func (db *DB) Executor() Executor + func (db *DB) Logger() Logger + func (db *DB) SetLogger(logger Logger) + func (db *DB) Update(ctx context.Context, model interface{}) error + func (db *DB) WithTx(ctx context.Context, fn func(*DB) error) error + type DefaultLogger struct + func NewDefaultLogger(verbose bool) *DefaultLogger + func (l *DefaultLogger) LogError(query string, args []interface{}, err error) + func (l *DefaultLogger) LogQuery(query string, args []interface{}, duration int64) + type Dialect interface + GetType func(goType string) string + Placeholder func(n int) string + QuoteIdentifier func(name string) string + type Executor interface + ExecContext func(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + QueryContext func(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) + QueryRowContext func(ctx context.Context, query string, args ...interface{}) *sql.Row + type Logger interface + LogError func(query string, args []interface{}, err error) + LogQuery func(query string, args []interface{}, duration int64) + type Model struct + CreatedAt time.Time + ID int64 + UpdatedAt time.Time + type NoOpLogger struct + func (n *NoOpLogger) LogError(query string, args []interface{}, err error) + func (n *NoOpLogger) LogQuery(query string, args []interface{}, duration int64) + type Optional struct + func FlatMap[T any, U any](o Optional[T], fn func(T) Optional[U]) Optional[U] + func FromPtr[T any](ptr *T) Optional[T] + func Map[T any, U any](o Optional[T], fn func(T) U) Optional[U] + func None[T any]() Optional[T] + func Some[T any](value T) Optional[T] + func (o *Optional[T]) Scan(value any) error + func (o *Optional[T]) UnmarshalJSON(data []byte) error + func (o Optional[T]) Filter(predicate func(T) bool) Optional[T] + func (o Optional[T]) Get() T + func (o Optional[T]) GetOrDefault(defaultValue T) T + func (o Optional[T]) GetOrZero() T + func (o Optional[T]) IfPresent(fn func(T)) + func (o Optional[T]) IfPresentOrElse(fnPresent func(T), fnAbsent func()) + func (o Optional[T]) IsAbsent() bool + func (o Optional[T]) IsPresent() bool + func (o Optional[T]) MarshalJSON() ([]byte, error) + func (o Optional[T]) Ptr() *T + func (o Optional[T]) Value() (driver.Value, error) + type Scanner interface + Scan func(dest ...interface{}) error + type TableNamer interface + TableName func() string