Versions in this module Expand all Collapse all v0 v0.2.2 Jan 21, 2022 Changes in this version + const Composite + const Invade + const None + const Ptr + const Single + const Slice + var ErrContainEmpty = errors.New("slice empty") + var ErrNil = errors.New("nil") + var ErrNoPkOrUnique = errors.New(...) + var ImpNuller = reflect.TypeOf((*types.NullEr)(nil)).Elem() + var ImpValuer = reflect.TypeOf((*driver.Valuer)(nil)).Elem() + type ColFieldIndexLinkMap []int + type DB struct + func Connect(c DbConfig, pc *PoolConf) (*DB, error) + func MustConnect(c DbConfig, pc *PoolConf) *DB + func MustConnectMock(db *sql.DB, c DbConfig) *DB + func (db DB) Begin() DB + func (db DB) BeginTx(ctx context.Context, opts *sql.TxOptions) DB + func (db DB) Builder() *SqlBuilder + func (db DB) Commit() error + func (db DB) Delete(v interface{}) OrmTableDelete + func (db DB) Exec(query string, args ...interface{}) (rowsNum int64, err error) + func (db DB) Has(v interface{}) OrmTableHas + func (db DB) Insert(v interface{}) (num int64, err error) + func (db DB) InsertOrUpdate(v interface{}) OrmTableCreate + func (db DB) OrmConf(c *OrmConf) DB + func (db DB) Page(size int, current int64) *SqlBuilder + func (db DB) Prepare(query string) (s Stmt, err error) + func (db DB) Query(query string, args ...interface{}) *NativeQuery + func (db DB) Rollback() error + func (db DB) Select(v interface{}) OrmTableSelect + func (db DB) Update(v interface{}) OrmTableUpdate + type DBer interface + Exec func(query string, args ...interface{}) (sql.Result, error) + Prepare func(query string) (*sql.Stmt, error) + Query func(query string, args ...interface{}) (*sql.Rows, error) + type DbConfig interface + Dialect func(db *sql.DB, pc *PoolConf) Dialect + Open func() (*sql.DB, error) + type Dialect interface + Copy func(db DBer) Dialect + type EngineBatch struct + type Logger struct + func (l *Logger) Fatalln(msg string, v ...interface{}) + func (l *Logger) Panicln(msg string, v ...interface{}) + func (l *Logger) Println(msg string, v ...interface{}) + type MysqlConf struct + DbName string + Host string + Password string + Port string + User string + func (c *MysqlConf) Dialect(db *sql.DB, pc *PoolConf) Dialect + func (c *MysqlConf) Open() (*sql.DB, error) + type MysqlDialect struct + func (m MysqlDialect) Copy(db DBer) Dialect + type NativeQuery struct + func (q NativeQuery) GetList(dest interface{}) (rowsNum int64, err error) + func (q NativeQuery) GetOne(dest interface{}) (rowsNum int64, err error) + type OrmConf struct + Author string + FieldNamePrefix string + IdType int + IsActiveRecord bool + IsFileOverride bool + LogicDeleteNoSql string + LogicDeleteSetSql string + LogicDeleteYesSql string + PoDir string + PrimaryKeyNameFun func(tableName string) []string + PrimaryKeyNames []string + TableNameFun func(structName string, dest interface{}) string + TableNamePrefix string + TenantIdFieldName string + TenantIdValueFun func() interface{} + TenantIgnoreTableFun func(tableName string) bool + func (c OrmConf) GenWhere(keys []string, hasTen bool) []byte + type OrmContext struct + func (ctx OrmContext) Copy() OrmContext + func (ctx OrmContext) Scan(rows *sql.Rows) (int64, error) + func (ctx OrmContext) ScanBatch(rowss []*sql.Rows) (int64, error) + func (ctx OrmContext) ScanLn(rows *sql.Rows) (num int64, err error) + type OrmTableCreate struct + func (orm OrmTableCreate) ByPrimaryKey() (int64, error) + func (orm OrmTableCreate) ByUnique(fs types.Fields) (int64, error) + type OrmTableDelete struct + func (orm OrmTableDelete) ByModel(v interface{}) (int64, error) + func (orm OrmTableDelete) ByPrimaryKey(v ...interface{}) (int64, error) + func (orm OrmTableDelete) ByWhere(w *WhereBuilder) (int64, error) + type OrmTableHas struct + func (orm OrmTableHas) ByModel(v interface{}) (bool, error) + func (orm OrmTableHas) ByPrimaryKey(v ...interface{}) (bool, error) + func (orm OrmTableHas) ByWhere(w *WhereBuilder) (bool, error) + type OrmTableSelect struct + func (orm OrmTableSelect) ByModel(v interface{}) OrmTableSelectWhere + func (orm OrmTableSelect) ByPrimaryKey(v ...interface{}) OrmTableSelectWhere + func (orm OrmTableSelect) ByWhere(w *WhereBuilder) OrmTableSelectWhere + type OrmTableSelectWhere struct + func (orm OrmTableSelectWhere) Limit(num int64, condition ...bool) OrmTableSelectWhere + func (orm OrmTableSelectWhere) Offset(num int64, condition ...bool) OrmTableSelectWhere + func (orm OrmTableSelectWhere) OrderBy(name string, condition ...bool) OrmTableSelectWhere + func (orm OrmTableSelectWhere) OrderDescBy(name string, condition ...bool) OrmTableSelectWhere + func (orm OrmTableSelectWhere) ScanFirst(v interface{}) (int64, error) + func (orm OrmTableSelectWhere) ScanList(v interface{}) (int64, error) + func (orm OrmTableSelectWhere) ScanOne(v interface{}) (int64, error) + type OrmTableUpdate struct + func (orm OrmTableUpdate) ByModel(v interface{}) (int64, error) + func (orm OrmTableUpdate) ByPrimaryKey() (int64, error) + func (orm OrmTableUpdate) ByWhere(w *WhereBuilder) (int64, error) + type PackTyp struct + Base reflect.Value + SliceBase reflect.Value + Typ packType + type Page struct + Current int64 + Pages int64 + Records interface{} + Size int + Total int64 + type PageCnfig struct + type PgConf struct + DbName string + Host string + Other string + Password string + Port string + User string + func (c *PgConf) Dialect(db *sql.DB, pc *PoolConf) Dialect + func (c *PgConf) Open() (*sql.DB, error) + type PgDialect struct + func (m PgDialect) Copy(db DBer) Dialect + type PoolConf struct + Logger *log.Logger + MaxIdleCount int + MaxIdleTime time.Duration + MaxLifetime time.Duration + MaxOpen int + type Prepare struct + func (p Prepare) ScanFirst(v interface{}) (int64, error) + func (p Prepare) ScanList(v interface{}) (int64, error) + func (p Prepare) ScanOne(v interface{}) (int64, error) + type SqlBuilder struct + func (b *SqlBuilder) AppendArg(arg interface{}, condition ...bool) *SqlBuilder + func (b *SqlBuilder) AppendArgs(args ...interface{}) *SqlBuilder + func (b *SqlBuilder) AppendSql(sql string) *SqlBuilder + func (b *SqlBuilder) Arg(arg interface{}, condition ...bool) *SqlBuilder + func (b *SqlBuilder) Args(args ...interface{}) *SqlBuilder + func (b *SqlBuilder) Exec() (rowsNum int64, err error) + func (b *SqlBuilder) From(name string) *SqlBuilder + func (b *SqlBuilder) Join(name string, condition ...bool) *SqlBuilder + func (b *SqlBuilder) LeftJoin(name string, condition ...bool) *SqlBuilder + func (b *SqlBuilder) Limit(num int64, condition ...bool) *SqlBuilder + func (b *SqlBuilder) Native(sql string, condition ...bool) *SqlBuilder + func (b *SqlBuilder) Offset(num int64, condition ...bool) *SqlBuilder + func (b *SqlBuilder) OrderBy(name string, condition ...bool) *SqlBuilder + func (b *SqlBuilder) OrderDescBy(name string, condition ...bool) *SqlBuilder + func (b *SqlBuilder) PageScan(dest interface{}) (rowsNum int64, dto Page, err error) + func (b *SqlBuilder) RightJoin(name string, condition ...bool) *SqlBuilder + func (b *SqlBuilder) ScanList(dest interface{}) (rowsNum int64, err error) + func (b *SqlBuilder) ScanOne(dest interface{}) (rowsNum int64, err error) + func (b *SqlBuilder) Select(arg string, condition ...bool) *SqlBuilder + func (b *SqlBuilder) SelectModel(v interface{}) *SqlBuilder + func (b *SqlBuilder) Where(whereStr string, condition ...bool) *SqlBuilder + func (b *SqlBuilder) WhereBuilder(v *WhereBuilder) *SqlBuilder + type Stmt struct + func (s *Stmt) Exec(args ...interface{}) Prepare + func (s *Stmt) Query(args ...interface{}) (int64, error) + type StructValidFieldValueMap map[string]interface + type WhereBuilder struct + func (w *WhereBuilder) Eq(query string, arg interface{}, condition ...bool) *WhereBuilder + func (w *WhereBuilder) Like(query, arg string, condition ...bool) *WhereBuilder + func (w *WhereBuilder) Ne(query string, arg interface{}, condition ...bool) *WhereBuilder + func (w *WhereBuilder) NoLike(query, arg string, condition ...bool) *WhereBuilder + type WhereContext struct