Documentation
¶
Overview ¶
Package sql provides opinionated interfaces around the database/sql implementations. In general, they are they same except: 1) they accepts context.Context parameters without using the *Context suffix. 2) types are interfaces so they can be easily mocked in tests. 3) Scanner represents a row or rows, rather than a column.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface { Ping(ctx context.Context) error Prepare(ctx context.Context, query string) (Stmt, error) BeginTx(ctx context.Context, opts *TxOptions) (Tx, error) Exec(ctx context.Context, query string, args ...interface{}) (Result, error) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error) QueryRow(ctx context.Context, query string, args ...interface{}) *Row Close() error StdConn() *sql.Conn }
The following are interface wrappers around concrete types in database/sql.
type DB ¶
type DB interface { Ping(ctx context.Context) error Prepare(ctx context.Context, query string) (Stmt, error) BeginTx(ctx context.Context, opts *TxOptions) (Tx, error) Exec(ctx context.Context, query string, args ...interface{}) (Result, error) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error) QueryRow(ctx context.Context, query string, args ...interface{}) *Row Driver() driver.Driver StdDB() *sql.DB }
The following are interface wrappers around concrete types in database/sql.
type DBStats ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type IsolationLevel ¶
type IsolationLevel = sql.IsolationLevel
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type NamedArg ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type NullBool ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type NullFloat64 ¶
type NullFloat64 = sql.NullFloat64
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type NullInt32 ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type NullInt64 ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type NullString ¶
type NullString = sql.NullString
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type NullTime ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type Out ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type RawBytes ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type Result ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type Row ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type Rows ¶
The following types are simple aliases that are exported to make it easier to consume this package. These aliases allow users to use this package without also importing database/sql, thus causing a package name collision.
type Scanner ¶
type Scanner interface {
Scan(...interface{}) error
}
Scanner abstracts sql.Rows and sql.Row. Note: this is DIFFERENT than the sql.Scanner interface.
type Stmt ¶
type Stmt interface { Exec(ctx context.Context, args ...interface{}) (Result, error) Query(ctx context.Context, args ...interface{}) (*Rows, error) QueryRow(ctx context.Context, args ...interface{}) *Row Close() error StdStmt() *sql.Stmt }
The following are interface wrappers around concrete types in database/sql.
type Tx ¶
type Tx interface { Commit() error Rollback() error Prepare(ctx context.Context, query string) (Stmt, error) Exec(ctx context.Context, query string, args ...interface{}) (Result, error) Query(ctx context.Context, query string, args ...interface{}) (*Rows, error) QueryRow(ctx context.Context, query string, args ...interface{}) *Row StdTx() *sql.Tx }
The following are interface wrappers around concrete types in database/sql.