Documentation ¶
Index ¶
- type DB
- type Tx
- func (t *Tx) Commit() error
- func (t *Tx) Exec(query string, args ...interface{}) (sql.Result, error)
- func (t *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
- func (t *Tx) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (t *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (t *Tx) QueryRow(query string, args ...interface{}) *sql.Row
- func (t *Tx) QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (t *Tx) Rollback() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { Begin() (*Tx, error) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) Close() error Conn(ctx context.Context) (*sql.Conn, error) Exec(query string, args ...any) (sql.Result, error) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) Ping() error PingContext(ctx context.Context) error Prepare(query string) (*sql.Stmt, error) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) Query(query string, args ...any) (*sql.Rows, error) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) QueryRow(query string, args ...any) *sql.Row QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row SetConnMaxIdleTime(d time.Duration) SetConnMaxLifetime(d time.Duration) Stats() sql.DBStats WithLogger(l *zap.Logger) DB }
func DBProvider ¶
DBProvider returns a NativeDatabase interface for the given driver and DSN WARNING: It will panic if the driver is not supported
func TracedNativeDBWrapper ¶
TracedNativeDBWrapper returns a DB interface for the given driver and DSN WARNING: It will panic if the driver is not supported
type Tx ¶
func (*Tx) Exec ¶
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. params:
- query: query to execute
- args: arguments to pass to query
returns:
- sql.Result: result of query
- error: error if any
func (*Tx) ExecContext ¶
func (t *Tx) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. params:
- query: query to execute
- args: arguments to pass to query
returns:
- sql.Result: result of query
- error: error if any
func (*Tx) Query ¶
Exec executes a query without returning any rows. The args are for any placeholder parameters in the query. params:
- query: query to execute
- args: arguments to pass to query
returns:
- sql.Result: result of query
- error: error if any
func (*Tx) QueryContext ¶
func (t *Tx) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
QueryContext executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query. params:
- ctx: context
- query: query to execute
- args: arguments to pass to query
returns:
- *sql.Rows: rows returned by query
- error: error if any
func (*Tx) QueryRow ¶
QueryContext executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query. params:
- query: query to execute
- args: arguments to pass to query
returns:
- *sql.Row: row returned by query
func (*Tx) QueryRowContext ¶
QueryContext executes a query that returns rows, typically a SELECT. The args are for any placeholder parameters in the query. params:
- query: query to execute
- args: arguments to pass to query
returns:
- *sql.Row: row returned by query