Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn interface { Stmt BeginTx(ctx context.Context, opts *sql.TxOptions) (Tx, error) Close() error PingContext(ctx context.Context) error }
Conn 是数据库连接接口, 对应 *sql.Conn.
type DB ¶
type DB interface { Stmt BeginTx(ctx context.Context, opts *sql.TxOptions) (Tx, error) Close() error Conn(ctx context.Context) (Conn, error) PingContext(ctx context.Context) error }
DB 是数据库接口, 对应 *sql.DB.
type Rows ¶
type Rows interface { Close() error Columns() ([]string, error) ColumnTypes() ([]*sql.ColumnType, error) Err() error Next() bool NextResultSet() bool Scan(dest ...interface{}) error }
Rows 对应 *sql.Rows.
type Stmt ¶
type Stmt interface { ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error) QueryContext(ctx context.Context, query string, args ...interface{}) (Rows, error) QueryRowContext(ctx context.Context, query string, args ...interface{}) Row // WithTimeout 返回一个新的 Stmt, 这个新的 Stmt 的超时时间是 timeout. // // 请注意当前的 Stmt 的不受影响. WithTimeout(timeout time.Duration) Stmt }
Stmt 是数据库 Statement 接口, 可以通过这个接口操作数据库.
Click to show internal directories.
Click to hide internal directories.