Versions in this module Expand all Collapse all go1 go1.18.10 Jan 10, 2023 Changes in this version + var ErrConnDone = errors.New("sql: connection is already closed") + var ErrNoRows = errors.New("sql: no rows in result set") + var ErrTxDone = errors.New("sql: transaction has already been committed or rolled back") + func Drivers() []string + func Register(name string, driver driver.Driver) + type ColumnType struct + func (ci *ColumnType) DatabaseTypeName() string + func (ci *ColumnType) DecimalSize() (precision, scale int64, ok bool) + func (ci *ColumnType) Length() (length int64, ok bool) + func (ci *ColumnType) Name() string + func (ci *ColumnType) Nullable() (nullable, ok bool) + func (ci *ColumnType) ScanType() reflect.Type + type Conn struct + func (c *Conn) BeginTx(ctx context.Context, opts *TxOptions) (*Tx, error) + func (c *Conn) Close() error + func (c *Conn) ExecContext(ctx context.Context, query string, args ...any) (Result, error) + func (c *Conn) PingContext(ctx context.Context) 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 + func (c *Conn) Raw(f func(driverConn any) error) (err error) + type DB struct + func Open(driverName, dataSourceName string) (*DB, error) + func OpenDB(c driver.Connector) *DB + func (db *DB) Begin() (*Tx, error) + func (db *DB) BeginTx(ctx context.Context, opts *TxOptions) (*Tx, error) + func (db *DB) Close() error + func (db *DB) Conn(ctx context.Context) (*Conn, error) + func (db *DB) Driver() driver.Driver + func (db *DB) Exec(query string, args ...any) (Result, error) + func (db *DB) ExecContext(ctx context.Context, query string, args ...any) (Result, error) + func (db *DB) Ping() error + func (db *DB) PingContext(ctx context.Context) 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 + func (db *DB) SetConnMaxIdleTime(d time.Duration) + func (db *DB) SetConnMaxLifetime(d time.Duration) + func (db *DB) SetMaxIdleConns(n int) + func (db *DB) SetMaxOpenConns(n int) + func (db *DB) Stats() DBStats + type DBStats struct + Idle int + InUse int + MaxIdleClosed int64 + MaxIdleTimeClosed int64 + MaxLifetimeClosed int64 + MaxOpenConnections int + OpenConnections int + WaitCount int64 + WaitDuration time.Duration + type IsolationLevel int + const LevelDefault + const LevelLinearizable + const LevelReadCommitted + const LevelReadUncommitted + const LevelRepeatableRead + const LevelSerializable + const LevelSnapshot + const LevelWriteCommitted + func (i IsolationLevel) String() string + type NamedArg struct + Name string + Value any + func Named(name string, value any) NamedArg + type NullBool struct + Bool bool + Valid bool + func (n *NullBool) Scan(value any) error + func (n NullBool) Value() (driver.Value, error) + type NullByte struct + Byte byte + Valid bool + func (n *NullByte) Scan(value any) error + func (n NullByte) Value() (driver.Value, error) + type NullFloat64 struct + Float64 float64 + Valid bool + func (n *NullFloat64) Scan(value any) error + func (n NullFloat64) Value() (driver.Value, error) + type NullInt16 struct + Int16 int16 + Valid bool + func (n *NullInt16) Scan(value any) error + func (n NullInt16) Value() (driver.Value, error) + type NullInt32 struct + Int32 int32 + Valid bool + func (n *NullInt32) Scan(value any) error + func (n NullInt32) Value() (driver.Value, error) + type NullInt64 struct + Int64 int64 + Valid bool + func (n *NullInt64) Scan(value any) error + func (n NullInt64) Value() (driver.Value, error) + type NullString struct + String string + Valid bool + func (ns *NullString) Scan(value any) error + func (ns NullString) Value() (driver.Value, error) + type NullTime struct + Time time.Time + Valid bool + func (n *NullTime) Scan(value any) error + func (n NullTime) Value() (driver.Value, error) + type Out struct + Dest any + In bool + type RawBytes []byte + type Result interface + LastInsertId func() (int64, error) + RowsAffected func() (int64, error) + type Row struct + func (r *Row) Err() error + func (r *Row) Scan(dest ...any) error + type Rows struct + func (rs *Rows) Close() error + func (rs *Rows) ColumnTypes() ([]*ColumnType, error) + func (rs *Rows) Columns() ([]string, error) + func (rs *Rows) Err() error + func (rs *Rows) Next() bool + func (rs *Rows) NextResultSet() bool + func (rs *Rows) Scan(dest ...any) error + type Scanner interface + Scan func(src any) error + type Stmt struct + func (s *Stmt) Close() error + func (s *Stmt) Exec(args ...any) (Result, error) + func (s *Stmt) ExecContext(ctx context.Context, args ...any) (Result, error) + func (s *Stmt) Query(args ...any) (*Rows, error) + func (s *Stmt) QueryContext(ctx context.Context, args ...any) (*Rows, error) + func (s *Stmt) QueryRow(args ...any) *Row + func (s *Stmt) QueryRowContext(ctx context.Context, args ...any) *Row + type Tx struct + func (tx *Tx) Commit() error + func (tx *Tx) Exec(query string, args ...any) (Result, error) + func (tx *Tx) ExecContext(ctx context.Context, query string, args ...any) (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 + type TxOptions struct + Isolation IsolationLevel + ReadOnly bool