Documentation
¶
Index ¶
- Constants
- func InSQL[T any](args []T) (string, []any)
- func LimitOffsetSQL(limit, offset int) string
- func Migrate(ctx context.Context, tx *Tx, name string, migrations []string) error
- func MigrateFS(ctx context.Context, db *DB, name string, fsys fs.FS) error
- func NewNullable[T comparable](value T) (null sql.Null[T])
- func NewSorts(sorts []string, keysToCols map[string]string) []string
- func OrderBySQL(sorts []string) string
- func PageLimitOffset(page, size int) (int, int)
- func WhereSQL(where []string) string
- type Conn
- func (c *Conn) BeginExclusiveTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Conn) BeginImmediateTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Conn) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (c *Conn) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (c *Conn) PrepareContext(ctx context.Context, query string) (*Stmt, error)
- func (c *Conn) QueryContext(ctx context.Context, query string, args ...any) (*Rows, error)
- func (c *Conn) QueryRowContext(ctx context.Context, query string, args ...any) *Row
- type DB
- func (db *DB) Begin() (*Tx, error)
- func (db *DB) BeginExclusiveTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (db *DB) BeginImmediateTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (db *DB) Conn(ctx context.Context) (*Conn, error)
- func (db *DB) Exec(query string, args ...any) (sql.Result, error)
- func (db *DB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (db *DB) Prepare(query string) (*Stmt, error)
- func (db *DB) PrepareContext(ctx context.Context, query string) (*Stmt, error)
- func (db *DB) Query(query string, args ...any) (*Rows, error)
- func (db *DB) QueryContext(ctx context.Context, query string, args ...any) (*Rows, error)
- func (db *DB) QueryRow(query string, args ...any) *Row
- func (db *DB) QueryRowContext(ctx context.Context, query string, args ...any) *Row
- type Duration
- type Kind
- type NullDuration
- type NullTime
- type OnConnectFunc
- type Row
- type Rows
- type Stmt
- func (stmt *Stmt) Exec(args ...any) (sql.Result, error)
- func (stmt *Stmt) ExecContext(ctx context.Context, args ...any) (sql.Result, error)
- func (stmt *Stmt) Query(args ...any) (*Rows, error)
- func (stmt *Stmt) QueryContext(ctx context.Context, args ...any) (*Rows, error)
- func (stmt *Stmt) QueryRow(args ...any) *Row
- func (stmt *Stmt) QueryRowContext(ctx context.Context, args ...any) *Row
- type Time
- type Tx
- func (tx *Tx) Commit() error
- func (tx *Tx) Exec(query string, args ...any) (sql.Result, error)
- func (tx *Tx) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (tx *Tx) Prepare(query string) (*Stmt, error)
- func (tx *Tx) PrepareContext(ctx context.Context, query string) (*Stmt, error)
- func (tx *Tx) Query(query string, args ...any) (*Rows, error)
- func (tx *Tx) QueryContext(ctx context.Context, query string, args ...any) (*Rows, error)
- func (tx *Tx) QueryRow(query string, args ...any) *Row
- func (tx *Tx) QueryRowContext(ctx context.Context, query string, args ...any) *Row
- func (tx *Tx) Rollback() error
- func (tx *Tx) Stmt(stmt *Stmt) *Stmt
- func (tx *Tx) StmtContext(ctx context.Context, stmt *Stmt) *Stmt
Constants ¶
const RFC3339NanoZero = "2006-01-02 15:04:05.000000000Z07:00"
Variables ¶
This section is empty.
Functions ¶
func LimitOffsetSQL ¶
func NewNullable ¶
func NewNullable[T comparable](value T) (null sql.Null[T])
func OrderBySQL ¶
func PageLimitOffset ¶
Types ¶
type Conn ¶
func (*Conn) BeginExclusiveTx ¶
BeginExclusiveTx starts an exclusive transaction with "begin exclusive".
This is a workaround for Go's database/sql package not providing a way to set the transaction type per connection.
References: - https://github.com/golang/go/issues/19981 - https://github.com/mattn/go-sqlite3/issues/400
func (*Conn) BeginImmediateTx ¶
BeginImmediateTx starts an immediate transaction with "begin immediate".
This is a workaround for Go's database/sql package not providing a way to set the transaction type per connection.
References: - https://github.com/golang/go/issues/19981 - https://github.com/mattn/go-sqlite3/issues/400
func (*Conn) ExecContext ¶
func (*Conn) PrepareContext ¶
func (*Conn) QueryContext ¶
type DB ¶
func (*DB) BeginExclusiveTx ¶
BeginExclusiveTx starts an exclusive transaction with "begin exclusive".
This is a workaround for Go's database/sql package not providing a way to set the transaction type per connection.
References: - https://github.com/golang/go/issues/19981 - https://github.com/mattn/go-sqlite3/issues/400
func (*DB) BeginImmediateTx ¶
BeginImmediateTx starts an immediate transaction with "begin immediate".
This is a workaround for Go's database/sql package not providing a way to set the transaction type per connection.
References: - https://github.com/golang/go/issues/19981 - https://github.com/mattn/go-sqlite3/issues/400
func (*DB) ExecContext ¶
func (*DB) PrepareContext ¶
func (*DB) QueryContext ¶
type NullDuration ¶
func (*NullDuration) Scan ¶
func (d *NullDuration) Scan(value any) error
func (NullDuration) String ¶
func (d NullDuration) String() string
type OnConnectFunc ¶
type OnConnectFunc func(conn *sqlite3.SQLiteConn) error