Documentation ¶
Index ¶
- func OpenDB(databaseURL *url.URL, migrationsDir string, skipMigration bool, debug bool) (*sql.DB, error)
- func ParseUrl(dbURL string) (*url.URL, error)
- type DBMethods
- func (d *DBMethods) Begin(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
- func (d *DBMethods) Close() error
- func (d *DBMethods) CurrentUnixTimestamp() int64
- func (d *DBMethods) DeleteRowByID(ctx context.Context, id int64, row any) error
- func (d *DBMethods) Each(ctx context.Context, query string, ...) error
- func (d *DBMethods) EachPrepared(ctx context.Context, prep *Prepared, ...) error
- func (d *DBMethods) Exec(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (d *DBMethods) ExecPrepared(ctx context.Context, prep *Prepared) (sql.Result, error)
- func (d *DBMethods) InsertRow(ctx context.Context, row any) error
- func (d *DBMethods) Ping(ctx context.Context) error
- func (d *DBMethods) Prepare(ctx context.Context, query string) (*sql.Stmt, error)
- func (d *DBMethods) PrepareSQL(query string, args ...any) *Prepared
- func (d *DBMethods) Query(ctx context.Context, query string, args ...any) (*Rows, error)
- func (d *DBMethods) QueryPrepared(ctx context.Context, prep *Prepared) (*Rows, error)
- func (d *DBMethods) QueryRow(ctx context.Context, query string, args ...any) *Row
- func (d *DBMethods) QueryRowByID(ctx context.Context, id int64, row any) error
- func (d *DBMethods) QueryRowPrepared(ctx context.Context, prep *Prepared) *Row
- func (d *DBMethods) RowExists(ctx context.Context, id int64, row any) bool
- func (d *DBMethods) SetConnMaxLifetime(t time.Duration)
- func (d *DBMethods) SetMaxIdleConns(n int)
- func (d *DBMethods) SetMaxOpenConns(n int)
- func (d *DBMethods) Transaction(ctx context.Context, callback func(ctx context.Context, tx *Tx) error) error
- func (d *DBMethods) UpdateRow(ctx context.Context, row any) error
- func (d *DBMethods) UpdateRowOnly(ctx context.Context, row any, fields ...string) error
- type Engine
- type Prepared
- type Row
- type Rows
- type Tx
- func (t *Tx) Commit() error
- func (t *Tx) CurrentUnixTimestamp() int64
- func (t *Tx) DeleteRowByID(ctx context.Context, id int64, row any) error
- func (t *Tx) Each(ctx context.Context, query string, ...) error
- func (t *Tx) EachPrepared(ctx context.Context, prep *Prepared, ...) error
- func (t *Tx) Exec(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (t *Tx) ExecPrepared(ctx context.Context, prep *Prepared) (sql.Result, error)
- func (t *Tx) InsertRow(ctx context.Context, row any) error
- func (t *Tx) PrepareSQL(query string, args ...any) *Prepared
- func (t *Tx) Query(ctx context.Context, query string, args ...any) (*Rows, error)
- func (t *Tx) QueryPrepared(ctx context.Context, prep *Prepared) (*Rows, error)
- func (t *Tx) QueryRow(ctx context.Context, query string, args ...any) *Row
- func (t *Tx) QueryRowByID(ctx context.Context, id int64, row any) error
- func (t *Tx) QueryRowPrepared(ctx context.Context, prep *Prepared) *Row
- func (t *Tx) Rollback() error
- func (t *Tx) RowExists(ctx context.Context, id int64, row any) bool
- func (t *Tx) UpdateRow(ctx context.Context, row any) error
- func (t *Tx) UpdateRowOnly(ctx context.Context, row any, fields ...string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DBMethods ¶
func (*DBMethods) CurrentUnixTimestamp ¶ added in v1.0.4
func (*DBMethods) DeleteRowByID ¶ added in v1.0.3
func (*DBMethods) EachPrepared ¶ added in v1.0.5
func (*DBMethods) ExecPrepared ¶ added in v1.0.5
func (*DBMethods) PrepareSQL ¶ added in v1.0.8
func (*DBMethods) QueryPrepared ¶ added in v1.0.5
func (*DBMethods) QueryRowByID ¶ added in v1.0.3
func (*DBMethods) QueryRowPrepared ¶ added in v1.0.5
func (*DBMethods) SetConnMaxLifetime ¶
func (*DBMethods) SetMaxIdleConns ¶
func (*DBMethods) SetMaxOpenConns ¶
func (*DBMethods) Transaction ¶
type Engine ¶
type Engine interface { Begin(ctx context.Context, opts *sql.TxOptions) (*Tx, error) Close() error CurrentUnixTimestamp() int64 DeleteRowByID(ctx context.Context, id int64, row any) error Each(ctx context.Context, query string, logic func(ctx context.Context, rows *Rows) error, args ...any) error EachPrepared(ctx context.Context, prep *Prepared, logic func(ctx context.Context, rows *Rows) error) error Exec(ctx context.Context, query string, args ...any) (sql.Result, error) ExecPrepared(ctx context.Context, prep *Prepared) (sql.Result, error) InsertRow(ctx context.Context, row any) error Ping(context.Context) error Prepare(ctx context.Context, query string) (*sql.Stmt, error) PrepareSQL(query string, args ...any) *Prepared Query(ctx context.Context, query string, args ...any) (*Rows, error) QueryPrepared(ctx context.Context, prep *Prepared) (*Rows, error) QueryRow(ctx context.Context, query string, args ...any) *Row QueryRowByID(ctx context.Context, id int64, row any) error QueryRowPrepared(ctx context.Context, prep *Prepared) *Row RowExists(ctx context.Context, id int64, row any) bool SetConnMaxLifetime(d time.Duration) SetMaxIdleConns(n int) SetMaxOpenConns(n int) Transaction(ctx context.Context, queries func(ctx context.Context, tx *Tx) error) error UpdateRow(ctx context.Context, row any) error UpdateRowOnly(ctx context.Context, row any, fields ...string) error }
type Tx ¶
func (*Tx) CurrentUnixTimestamp ¶ added in v1.0.4
func (*Tx) DeleteRowByID ¶ added in v1.0.3
func (*Tx) EachPrepared ¶ added in v1.0.5
func (*Tx) ExecPrepared ¶ added in v1.0.5
func (*Tx) PrepareSQL ¶ added in v1.0.8
func (*Tx) QueryPrepared ¶ added in v1.0.5
func (*Tx) QueryRowByID ¶ added in v1.0.3
func (*Tx) QueryRowPrepared ¶ added in v1.0.5
Click to show internal directories.
Click to hide internal directories.