Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoRows = sql.ErrNoRows ErrConnDone = sql.ErrConnDone ErrTxDone = sql.ErrTxDone )
Functions ¶
This section is empty.
Types ¶
type ColumnType ¶
type ColumnType interface { DatabaseTypeName() string DecimalSize() (precision, scale int64, ok bool) Length() (length int64, ok bool) Name() string Nullable() (nullable, ok bool) ScanType() reflect.Type }
func NewColumnType ¶
func NewColumnType(columnType *sql.ColumnType) ColumnType
type DB ¶
type DB interface { DBCore Begin() (Tx, error) BeginTx(ctx context.Context, opts *sql.TxOptions) (Tx, error) Close() error Driver() driver.Driver Exec(query string, args ...interface{}) (sql.Result, error) Ping() error PingContext(ctx context.Context) error Prepare(query string) (Stmt, error) PrepareContext(ctx context.Context, query string) (Stmt, error) Query(query string, args ...interface{}) (Rows, error) QueryRow(query string, args ...interface{}) Row SetConnMaxLifetime(d time.Duration) SetMaxIdleConns(n int) SetMaxOpenConns(n int) Stats() sql.DBStats }
type ReplicaSet ¶
type ReplicaSet interface { Primary() DB Slaves() []DB RandSlave() DB SetConnMaxLifetime(d time.Duration) SetMaxIdleConns(n int) SetMaxOpenConns(n int) }
func MustNewReplicaSet ¶
func MustNewReplicaSet(driverName, primaryDataSourceName string, slaveDataSourceNames ...string) ReplicaSet
func NewReplicaSet ¶
func NewReplicaSet(primaryDataSourceName string, slaveDataSourceNames ...string) (ReplicaSet, error)
type Rows ¶
type Stmt ¶
type Stmt interface { Close() error Exec(args ...interface{}) (sql.Result, error) ExecContext(ctx context.Context, args ...interface{}) (sql.Result, error) Query(args ...interface{}) (Rows, error) QueryContext(ctx context.Context, args ...interface{}) (Rows, error) QueryRow(args ...interface{}) Row QueryRowContext(ctx context.Context, args ...interface{}) Row }
type Tx ¶
type Tx interface { DBCore Commit() error Exec(query string, args ...interface{}) (sql.Result, error) Prepare(query string) (Stmt, error) PrepareContext(ctx context.Context, query string) (Stmt, error) Query(query string, args ...interface{}) (Rows, error) QueryRow(query string, args ...interface{}) Row Rollback() error Stmt(stmt *sql.Stmt) Stmt StmtContext(ctx context.Context, stmt *sql.Stmt) Stmt }
Click to show internal directories.
Click to hide internal directories.