Versions in this module Expand all Collapse all v2 v2.1.5 Sep 5, 2021 Changes in this version + var AUTO_CREATE_TIME_FIELDS = []string + var AUTO_UPDATE_TIME_FIELDS = []string + var FatalExit = true + func Connect(configs map[string]*Config) (err error) + func Exec(query string, args ...interface{}) (sql.Result, error) + func Expr(expression string, args ...interface{}) *expr + func Get(dest interface{}, query string, args ...interface{}) error + func IsZero(val reflect.Value) bool + func JsonObject(value interface{}) (json.RawMessage, error) + func List() map[string]*sqlx.DB + func NamedExec(query string, args interface{}) (sql.Result, error) + func QueryRowx(query string, args ...interface{}) *sqlx.Row + func Queryx(query string, args ...interface{}) (*sqlx.Rows, error) + func RegisterDialect(name string, dialect Dialect) + func RelationAll(wrapper *ModelWrapper, db *DB, data interface{}) error + func RelationOne(wrapper *ModelWrapper, db *DB, data interface{}) error + func Select(dest interface{}, query string, args ...interface{}) error + func SetDefaultLink(db string) + func SetLogger(l Logger) + func SetLogging(logging bool) + func Sqlx(name ...string) *sqlx.DB + func Tx(fn func(tx *DB) error) error + func Txx(ctx context.Context, fn func(ctx context.Context, tx *DB) error) error + type Builder struct + func Model(model interface{}) *Builder + func WithContext(ctx context.Context) *Builder + func (b *Builder) All() (err error) + func (b *Builder) Count(zeroValues ...string) (num int64, err error) + func (b *Builder) Create() (lastInsertId int64, err error) + func (b *Builder) Delete(zeroValues ...string) (affected int64, err error) + func (b *Builder) ForceIndex(i string) *Builder + func (b *Builder) Get(zeroValues ...string) (err error) + func (b *Builder) Hint(hint string) *Builder + func (b *Builder) Limit(i int) *Builder + func (b *Builder) Model(model interface{}) *Builder + func (b *Builder) Offset(i int) *Builder + func (b *Builder) OrderBy(str string) *Builder + func (b *Builder) Relation(fieldName string, fn BuilderChainFunc) *Builder + func (b *Builder) Select(fields string) *Builder + func (b *Builder) ShowSQL() *Builder + func (b *Builder) Update(zeroValues ...string) (affected int64, err error) + func (b *Builder) Where(str string, args ...interface{}) *Builder + type BuilderChainFunc func(b *Builder) + type Config struct + Driver string + Dsn string + Enable bool + MaxIdleConns int + MaxLifetime int + MaxOpenConns int + ShowSql bool + type DB struct + RelationMap map[string]BuilderChainFunc + func Begin() (*DB, error) + func Open(driver, dbSource string) (*DB, error) + func OpenWithDB(driver string, db *sql.DB) *DB + func Relation(name string, fn BuilderChainFunc) *DB + func ShowSql() *DB + func Use(db string) *DB + func (w *DB) Begin() (*DB, error) + func (w *DB) Commit() error + func (w *DB) DriverName() string + func (w *DB) Exec(query string, args ...interface{}) (result sql.Result, err error) + func (w *DB) Get(dest interface{}, query string, args ...interface{}) (err error) + func (w *DB) Model(m interface{}) *Builder + func (w *DB) NamedExec(query string, args interface{}) (result sql.Result, err error) + func (w *DB) Preparex(query string) (*sqlx.Stmt, error) + func (w *DB) QueryRowx(query string, args ...interface{}) (rows *sqlx.Row) + func (w *DB) Queryx(query string, args ...interface{}) (rows *sqlx.Rows, err error) + func (w *DB) Rebind(query string) string + func (w *DB) Relation(name string, fn BuilderChainFunc) *DB + func (w *DB) Rollback() error + func (w *DB) Select(dest interface{}, query string, args ...interface{}) (err error) + func (w *DB) ShowSql() *DB + func (w *DB) Table(t string) *Mapper + func (w *DB) Tx(fn func(w *DB) error) (err error) + func (w *DB) Txx(ctx context.Context, fn func(ctx context.Context, tx *DB) error) (err error) + func (w *DB) WithContext(ctx context.Context) *Builder + type Dialect interface + Count func() + GetName func() string + Placeholder func() string + Quote func(key string) string + func GetDialect(name string) (dialect Dialect, ok bool) + type Hook struct + Errs []error + func NewHook(ctx context.Context, db *DB) *Hook + func (h *Hook) Err(err error) + func (h *Hook) Error() error + func (h *Hook) HasError() bool + type IModel interface + PK func() string + TableName func() string + type ISqlx interface + DriverName func() string + Exec func(query string, args ...interface{}) (sql.Result, error) + Get func(dest interface{}, query string, args ...interface{}) error + NamedExec func(query string, arg interface{}) (sql.Result, error) + Preparex func(query string) (*sqlx.Stmt, error) + QueryRowx func(query string, args ...interface{}) *sqlx.Row + Queryx func(query string, args ...interface{}) (*sqlx.Rows, error) + Rebind func(query string) string + Select func(dest interface{}, query string, args ...interface{}) error + type JSONText json.RawMessage + func (j *JSONText) Scan(src interface{}) error + func (j *JSONText) Unmarshal(v interface{}) error + func (j *JSONText) UnmarshalBinary(data []byte) error + func (j *JSONText) UnmarshalJSON(data []byte) error + func (j JSONText) MarshalBinary() ([]byte, error) + func (j JSONText) MarshalJSON() ([]byte, error) + func (j JSONText) String() string + func (j JSONText) Value() (driver.Value, error) + type Logger interface + Printf func(format string, v ...interface{}) + type Mapper struct + func Table(t string) *Mapper + func (m *Mapper) Count() (num int64, err error) + func (m *Mapper) Create(data map[string]interface{}) (lastInsertId int64, err error) + func (m *Mapper) Delete() (affected int64, err error) + func (m *Mapper) ShowSQL() *Mapper + func (m *Mapper) Update(data map[string]interface{}) (affected int64, err error) + func (m *Mapper) Where(str string, args ...interface{}) *Mapper + type ModelWrapper struct + func NewModelWrapper(dbList map[string]*DB, model interface{}) *ModelWrapper + func (m *ModelWrapper) GetRelationDB(connect string) *DB + func (m *ModelWrapper) UnWrap() interface{} + type ModelWrapperFactory func(m interface{}) *ModelWrapper + type QueryStatus struct + Args interface{} + End time.Time + Err error + Query string + Start time.Time + func (q *QueryStatus) String() string + type ReflectMapper struct + func NewReflectMapper(tagName string) *ReflectMapper + func (r *ReflectMapper) FieldByName(v reflect.Value, name string) reflect.Value + func (r *ReflectMapper) FieldMap(v reflect.Value) map[string]reflect.Value + type SQLBuilder struct + func (s *SQLBuilder) Where(str string, args ...interface{}) Other modules containing this package github.com/guoanfamily/gosql