Versions in this module Expand all Collapse all v1 v1.1.2 Oct 6, 2026 Changes in this version + const MemoryDSN + const OpExact + const OpSubstring + const TimeFormat + func BuildComplexQuery(table string, primaryField string, fields string, filter *Filter, ...) (string, []any, error) + func BuildQuery(table string, primaryField string, fields string, filter *Filter, ...) (string, []any, error) + func UpdateQuery(table string, fn func(fields []string, args []any) ([]string, []any)) (string, []any, error) + func Where(field string, operator ...string) string + type BaseTX struct + func (b *BaseTX) Exec(ctx context.Context, stmt string, args ...any) (sql.Result, error) + func (b *BaseTX) ExecPrepared(ctx context.Context, stmt string, rows [][]any) error + func (b *BaseTX) Find(ctx context.Context, stmt string, args []any, ...) error + func (b *BaseTX) Logger() *zerolog.Logger + func (b *BaseTX) Query(ctx context.Context, stmt string, args ...any) (*sql.Rows, error) + func (b *BaseTX) QueryRow(ctx context.Context, stmt string, args ...any) *sql.Row + func (b *BaseTX) TX() *sql.Tx + type BatchTX struct + func (b *BatchTX) Logger() zerolog.Logger + func (b *BatchTX) QueueExec(_ context.Context, stmt string, args ...any) error + type Filter struct + ExactMatchByDefault bool + GroupBy string + Limit int + Offset any + OrderAsc bool + OrderBy string + type Service struct + func NewDB(dsn string, logger zerolog.Logger) *Service + func (s *Service) Close() error + func (s *Service) CommitBatch(_ context.Context, newTx func(*BatchTX) any, fn func(any) error) error + func (s *Service) CommitRead(ctx context.Context, newTx func(*BaseTX) any, fn func(any) error) error + func (s *Service) CommitWrite(ctx context.Context, newTx func(*BaseTX) any, fn func(any) error) error + func (s *Service) Migrate(ctx context.Context, migrations fs.FS) error + func (s *Service) OnBatchFlushError(handler func(error)) + func (s *Service) Open() error