Versions in this module Expand all Collapse all v1 v1.0.3 Apr 4, 2026 v1.0.2 Apr 2, 2026 Changes in this version + func QueryAll[T any](ctx context.Context, b *Block, query string, args ...any) ([]T, error) + type Block struct + func New(name string, opts ...Option) *Block + func (b *Block) DB() *sql.DB + func (b *Block) Exec(ctx context.Context, query string, args ...any) (ExecResult, error) + func (b *Block) Init(ctx context.Context) error + func (b *Block) Name() string + func (b *Block) Ping(ctx context.Context) error + func (b *Block) QueryOne(ctx context.Context, dest any, query string, args ...any) error + func (b *Block) QueryRows(ctx context.Context, query string, args ...any) ([]Row, error) + func (b *Block) Shutdown(_ context.Context) error + func (b *Block) Tx(ctx context.Context, fn func(*sql.Tx) error) error + type Driver string + const DriverMySQL + const DriverPostgres + type ExecResult struct + LastInsertID int64 + RowsAffected int64 + type Option func(*blockConfig) + func WithConnMaxIdleTime(d time.Duration) Option + func WithConnMaxLifetime(d time.Duration) Option + func WithDSN(dsn string) Option + func WithDatabase(db string) Option + func WithDriver(d Driver) Option + func WithHost(host string) Option + func WithMaxIdleConns(n int) Option + func WithMaxOpenConns(n int) Option + func WithPassword(pass string) Option + func WithPort(port int) Option + func WithQueryTimeout(d time.Duration) Option + func WithSSLMode(mode string) Option + func WithUsername(user string) Option + type Page struct + HasMore bool + Items []T + Page int + PageSize int + Total int64 + func QueryPage[T any](ctx context.Context, b *Block, pageNum, pageSize int, query string, ...) (Page[T], error) + type Row map[string]any