Documentation ¶
Index ¶
- Variables
- func AsAssignments(db DBExecutor, m builder.Model, zeros ...string) builder.Assignments
- func DBErr(err error) *dbErr
- func FieldValuesFromModel(table *builder.Table, model builder.Model, zeros ...string) builder.FieldValues
- func InsertToDB(db DBExecutor, m builder.Model, zeros []string, additions ...builder.Addition) builder.SqlExpr
- func Scan(ctx context.Context, rows *sql.Rows, v interface{}) error
- func UnwrapAll(err error) error
- func UnwrapOnce(err error) (cause error)
- type DB
- func (d *DB) Begin() (DBExecutor, error)
- func (d *DB) BeginTx(opt *sql.TxOptions) (DBExecutor, error)
- func (d *DB) Commit() error
- func (d *DB) Context() context.Context
- func (d *DB) D() *Database
- func (d *DB) Dialect() builder.Dialect
- func (d *DB) Exec(e builder.SqlExpr) (sql.Result, error)
- func (d *DB) IsTx() bool
- func (d *DB) Migrate(ctx context.Context, db DBExecutor) error
- func (d *DB) Query(e builder.SqlExpr) (*sql.Rows, error)
- func (d *DB) QueryAndScan(e builder.SqlExpr, v interface{}) error
- func (d *DB) Rollback() error
- func (d *DB) SetConnMaxLifetime(du time.Duration)
- func (d *DB) SetMaxIdleConns(n int)
- func (d *DB) SetMaxOpenConns(n int)
- func (d *DB) WithContext(ctx context.Context) DBExecutor
- func (d DB) WithSchema(schema string) DBExecutor
- type DBExecutor
- type Database
- func (d *Database) AddTable(t *builder.Table)
- func (d *Database) OpenDB(connector driver.Connector) *DB
- func (d *Database) Register(m builder.Model) *builder.Table
- func (d *Database) T(model builder.Model) *builder.Table
- func (d *Database) Table(name string) *builder.Table
- func (d Database) WithSchema(schema string) *Database
- type ExprExecutor
- type Migrator
- type ScanIterator
- type SqlError
- type SqlExecutor
- type TableResolver
- type Task
- type Tasks
- type TxExecutor
- type WithDBName
Constants ¶
This section is empty.
Variables ¶
View Source
var DuplicateEntryErrNumber uint16 = 1062
View Source
var ErrNotDB = errors.New("db is not *sql.DB")
View Source
var ErrNotTx = errors.New("db is not *sql.Tx")
Functions ¶
func AsAssignments ¶
func AsAssignments(db DBExecutor, m builder.Model, zeros ...string) builder.Assignments
func FieldValuesFromModel ¶
func InsertToDB ¶
func UnwrapOnce ¶
Types ¶
type DB ¶
type DB struct { *Database SqlExecutor // contains filtered or unexported fields }
func (*DB) Begin ¶
func (d *DB) Begin() (DBExecutor, error)
func (*DB) SetConnMaxLifetime ¶
func (*DB) SetMaxIdleConns ¶
func (*DB) SetMaxOpenConns ¶
func (*DB) WithContext ¶
func (d *DB) WithContext(ctx context.Context) DBExecutor
func (DB) WithSchema ¶
func (d DB) WithSchema(schema string) DBExecutor
type DBExecutor ¶
type DBExecutor interface { ExprExecutor TableResolver Dialect() builder.Dialect D() *Database WithSchema(string) DBExecutor Context() context.Context WithContext(ctx context.Context) DBExecutor }
type ExprExecutor ¶
type ScanIterator ¶
type ScanIterator = scanner.ScanIterator
type SqlExecutor ¶
type Task ¶
type Task func(db DBExecutor) error
func (Task) Run ¶
func (task Task) Run(db DBExecutor) (err error)
type Tasks ¶
type Tasks struct {
// contains filtered or unexported fields
}
func NewTasks ¶
func NewTasks(db DBExecutor) *Tasks
type TxExecutor ¶
type TxExecutor interface { IsTx() bool BeginTx(*sql.TxOptions) (DBExecutor, error) Begin() (DBExecutor, error) Commit() error Rollback() error }
type WithDBName ¶
Click to show internal directories.
Click to hide internal directories.