Versions in this module Expand all Collapse all v0 v0.0.1 Dec 23, 2021 Changes in this version + const MiddlewareName + var ErrInvalidConnForListen = errors.New("conn does not support LISTEN / NOTIFY") + var ErrInvalidTransaction = errors.New("invalid transaction") + var ErrInvalidValue = errors.New("invalid value, should be pointer to struct or slice") + var StandardTimeLayout = "2006-01-02 15:04:05" + func MaxIdle(count int) mist.Option + func MaxOpen(count int) mist.Option + func MysqlAddress(name, read, write string) mist.Option + func PgAddress(name, read, write string) mist.Option + func Scan(rows *sql.Rows, db *DB) + type Builder interface + AddVar func(vars ...interface{}) + WriteQuoted func(field interface{}) + type Clause struct + Expression Expression + Name string + func (c Clause) Build(builder Builder) + type ConnPool interface + ExecContext func(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + PrepareContext func(ctx context.Context, query string) (*sql.Stmt, error) + QueryContext func(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) + QueryRowContext func(ctx context.Context, query string, args ...interface{}) *sql.Row + type DB struct + Error error + LastInsertId int64 + RowsAffected int64 + Statement *Statement + func Get(ctx context.Context, args ...string) *DB + func (db *DB) AddError(err error) error + func (db *DB) AddNameMap(old, new string) (tx *DB) + func (db *DB) Begin(opts ...*sql.TxOptions) *DB + func (db *DB) Commit() *DB + func (db *DB) Exec(sql string, args ...interface{}) (tx *DB) + func (db *DB) Find(dest interface{}) (tx *DB) + func (db *DB) GroupBy(column string) (tx *DB) + func (db *DB) Limit(limit int) (tx *DB) + func (db *DB) Listen(ctx context.Context, channel string) (abstract.Observable, error) + func (db *DB) MustWrite() (tx *DB) + func (db *DB) Offset(offset int) (tx *DB) + func (db *DB) Order(value interface{}) (tx *DB) + func (db *DB) Paging(page, perPage int) (tx *DB) + func (db *DB) Query(sql string, args ...interface{}) (tx *DB) + func (db *DB) QueryReturn(sql string, args ...interface{}) (tx *DB) + func (db *DB) Reset() (tx *DB) + func (db *DB) Rollback() *DB + func (db *DB) Rows() []*DataRow + func (db *DB) Where(where ...interface{}) (tx *DB) + func (m *DB) ID() string + func (m *DB) TypeName() string + type DataRow struct + Fields map[string]interface{} + func (d *DataRow) GetFloat64(fieldName string) float64 + func (d *DataRow) GetInt(fieldName string) int + func (d *DataRow) GetInt32(fieldName string) int32 + func (d *DataRow) GetInt64(fieldName string) int64 + func (d *DataRow) GetString(fieldName string) string + func (d *DataRow) GetTime(fieldName string) time.Time + func (d *DataRow) GetTimeStr(fieldName string) string + type Expression interface + Build func(builder Builder) + type IClause interface + Build func(Builder) + MergeClause func(*Clause) + Name func() string + type Limit struct + Limit int + Offset int + func (limit Limit) Build(builder Builder) + func (limit Limit) MergeClause(clause *Clause) + func (limit Limit) Name() string + type Middleware struct + func (m *Middleware) Close() error + func (m *Middleware) Init(opt []mist.Option) + func (m *Middleware) Inter(full bool) mist.Interceptor + type Statement struct + BuildClauses []string + Clauses map[string]Clause + ConnPool ConnPool + Context context.Context + Dest interface{} + Model interface{} + NameMapper map[string]string + ReflectValue reflect.Value + SQL strings.Builder + Schema *schema.Schema + Table string + Vals []interface{} + func (st *Statement) AddClause(v IClause) + func (st *Statement) AddVar(vars ...interface{}) + func (st *Statement) Build(clauses ...string) + func (st *Statement) Parse(value interface{}) (err error) + func (st *Statement) Reset() (tx *DB) + func (st *Statement) WriteByte(c byte) error + func (st *Statement) WriteQuoted(value interface{}) + func (st *Statement) WriteString(str string) (int, error) + type TxBeginner interface + BeginTx func(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) + type TxCommitter interface + Commit func() error + Rollback func() error + type Where struct + Columns []WhereColumn + func (where *Where) And(field string, quality WhereEquality, value interface{}) WhereColumn + func (where *Where) Or(field string, quality WhereEquality, value interface{}) WhereColumn + func (where Where) Build(builder Builder) + func (where Where) MergeClause(clause *Clause) + func (where Where) Name() string + type WhereColumn interface + C func(WhereColumn) + IsEmpty func() bool + Len func() int + func And(field string, quality, value interface{}) WhereColumn + type WhereEquality string + const WE_BETWEEN + const WE_EQ + const WE_GT + const WE_GTE + const WE_IN + const WE_LK + const WE_LT + const WE_LTE + const WE_NE + func ToWhereEquality(op string) WhereEquality + func (we WhereEquality) Equality() string + type Writer interface + WriteByte func(byte) error + WriteString func(string) (int, error)