Versions in this module Expand all Collapse all v2 v2.1.2 Sep 10, 2019 Changes in this version + const DriverOracle + const GOROSE_IMG + const VERSION + const VERSION_NO + const VERSION_TEXT + var BindString = map[BindType]string + var IGNORE = "-" + var TAGNAME = "gorose" + func DefaultLogger() func(e *Engin) + func GetErr(err Error, args ...interface{}) error + func If(condition bool, trueVal, falseVal interface{}) interface + func StructToMap(obj interface{}) map[string]interface + type BindType int + const OBJECT_MAP + const OBJECT_MAP_SLICE + const OBJECT_MAP_SLICE_T + const OBJECT_MAP_T + const OBJECT_NIL + const OBJECT_STRING + const OBJECT_STRUCT + const OBJECT_STRUCT_SLICE + func (b BindType) String() string + type Binder struct + BindAll []Data + BindFields []string + BindLimit int + BindName string + BindOrigin interface{} + BindPrefix string + BindResult interface{} + BindResultSlice reflect.Value + BindType BindType + func (o *Binder) GetBindAll() []Data + func (o *Binder) GetBindFields() []string + func (o *Binder) GetBindName() string + func (o *Binder) GetBindOrigin() interface{} + func (o *Binder) GetBindPrefix() string + func (o *Binder) GetBindResult() interface{} + func (o *Binder) GetBindResultSlice() reflect.Value + func (o *Binder) GetBindType() BindType + func (o *Binder) ResetBindResultSlice() + func (o *Binder) SetBindAll(arg []Data) + func (o *Binder) SetBindFields(arg []string) + func (o *Binder) SetBindName(arg string) + func (o *Binder) SetBindOrigin(arg interface{}) + func (o *Binder) SetBindPrefix(arg string) + func (o *Binder) SetBindResult(arg interface{}) + func (o *Binder) SetBindResultSlice(arg reflect.Value) + func (o *Binder) SetBindType(arg BindType) + func (s *Binder) BindParse(prefix string) error + type BuilderClickhouse struct + func (b *BuilderClickhouse) BuildExecute(o IOrm, operType string) (sqlStr string, args []interface{}, err error) + func (b *BuilderClickhouse) BuildQuery(o IOrm) (sqlStr string, args []interface{}, err error) + type BuilderDefault struct + func NewBuilderDefault(o IOrm) *BuilderDefault + func (b *BuilderDefault) BuildData(operType string) (string, string, string) + func (b *BuilderDefault) BuildData2(operType string) (string, string, string) + func (b *BuilderDefault) BuildDistinct() (dis string) + func (b *BuilderDefault) BuildExecute(operType string) (sqlStr string, args []interface{}, err error) + func (b *BuilderDefault) BuildFields() string + func (b *BuilderDefault) BuildGroup() string + func (b *BuilderDefault) BuildHaving() string + func (b *BuilderDefault) BuildJoin() (s string, err error) + func (b *BuilderDefault) BuildLimit() string + func (b *BuilderDefault) BuildOffset() string + func (b *BuilderDefault) BuildOrder() string + func (b *BuilderDefault) BuildQuery() (sqlStr string, args []interface{}, err error) + func (b *BuilderDefault) BuildTable() string + func (b *BuilderDefault) BuildWhere() (where string, err error) + func (b *BuilderDefault) GetOperator() []string + func (b *BuilderDefault) GetPlaceholder() (phstr string) + func (b *BuilderDefault) SetDriver(dr string) *BuilderDefault + type BuilderDriver struct + func NewBuilderDriver() *BuilderDriver + func (b *BuilderDriver) Getter(driver string) (ib IBuilder) + func (b *BuilderDriver) Register(driver string, val IBuilder) + type BuilderMsSql struct + func (b *BuilderMsSql) BuildExecute(o IOrm, operType string) (sqlStr string, args []interface{}, err error) + func (b *BuilderMsSql) BuildQuery(o IOrm) (sqlStr string, args []interface{}, err error) + type BuilderMysql struct + func (b *BuilderMysql) BuildExecute(o IOrm, operType string) (sqlStr string, args []interface{}, err error) + func (b *BuilderMysql) BuildQuery(o IOrm) (sqlStr string, args []interface{}, err error) + type BuilderOracle struct + func NewBuilderOracle(o IOrm) *BuilderOracle + func (b *BuilderOracle) BuildData(operType string) (string, string, string) + func (b *BuilderOracle) BuildData2(operType string) (string, string, string) + func (b *BuilderOracle) BuildDistinct() (dis string) + func (b *BuilderOracle) BuildExecute(o IOrm, operType string) (sqlStr string, args []interface{}, err error) + func (b *BuilderOracle) BuildExecuteOra(operType string) (sqlStr string, args []interface{}, err error) + func (b *BuilderOracle) BuildFields() string + func (b *BuilderOracle) BuildGroup() string + func (b *BuilderOracle) BuildHaving() string + func (b *BuilderOracle) BuildJoin() (s string, err error) + func (b *BuilderOracle) BuildLimit() string + func (b *BuilderOracle) BuildOffset() string + func (b *BuilderOracle) BuildOrder() string + func (b *BuilderOracle) BuildQuery(o IOrm) (sqlStr string, args []interface{}, err error) + func (b *BuilderOracle) BuildQueryOra() (sqlStr string, args []interface{}, err error) + func (b *BuilderOracle) BuildTable() string + func (b *BuilderOracle) BuildWhere() (where string, err error) + func (b *BuilderOracle) GetOperator() []string + func (b *BuilderOracle) GetPlaceholder() (phstr string) + func (b *BuilderOracle) SetDriver(dr string) *BuilderOracle + type BuilderPostgres struct + func (b *BuilderPostgres) BuildExecute(o IOrm, operType string) (sqlStr string, args []interface{}, err error) + func (b *BuilderPostgres) BuildQuery(o IOrm) (sqlStr string, args []interface{}, err error) + type BuilderSqlite3 struct + func (b *BuilderSqlite3) BuildExecute(o IOrm, operType string) (sqlStr string, args []interface{}, err error) + func (b *BuilderSqlite3) BuildQuery(o IOrm) (sqlStr string, args []interface{}, err error) + type Config struct + Driver string + Dsn string + Prefix string + SetMaxIdleConns int + SetMaxOpenConns int + type ConfigCluster struct + Driver string + Master []Config + Prefix string + Slave []Config + type Data map[string]interface + type Engin struct + func NewEngin(conf ...interface{}) (e *Engin, err error) + func Open(conf ...interface{}) (engin *Engin, err error) + func (c *Engin) GetDriver() string + func (c *Engin) GetExecuteDB() *sql.DB + func (c *Engin) GetLogger() ILogger + func (c *Engin) GetPrefix() string + func (c *Engin) GetQueryDB() *sql.DB + func (c *Engin) IgnoreName(arg string) + func (c *Engin) NewOrm() IOrm + func (c *Engin) NewSession() ISession + func (c *Engin) Ping() error + func (c *Engin) SetPrefix(pre string) + func (c *Engin) TagName(arg string) + func (c *Engin) Use(closers ...func(e *Engin)) + type Err struct + func NewErr() *Err + func (e *Err) Default() map[Error]string + func (e *Err) Get(err Error) string + func (e *Err) GetLang() Lang + func (e *Err) Register(err map[Error]string) + func (e *Err) SetLang(l Lang) + type Error uint + const ERR_PARAMS_COUNTS + const ERR_PARAMS_FORMAT + const ERR_PARAMS_MISSING + type IBinder interface + BindParse func(prefix string) error + GetBindAll func() []Data + GetBindFields func() []string + GetBindName func() string + GetBindOrigin func() interface{} + GetBindPrefix func() string + GetBindResult func() interface{} + GetBindResultSlice func() reflect.Value + GetBindType func() BindType + ResetBindResultSlice func() + SetBindAll func(arg []Data) + SetBindFields func(arg []string) + SetBindName func(arg string) + SetBindOrigin func(arg interface{}) + SetBindPrefix func(arg string) + SetBindResult func(arg interface{}) + SetBindResultSlice func(arg reflect.Value) + SetBindType func(arg BindType) + func NewBinder(o ...interface{}) IBinder + type IBuilder interface + BuildExecute func(orm IOrm, operType string) (sqlStr string, args []interface{}, err error) + BuildQuery func(orm IOrm) (sqlStr string, args []interface{}, err error) + func NewBuilder(driver string) IBuilder + type IEngin interface + GetDriver func() string + GetExecuteDB func() *sql.DB + GetLogger func() ILogger + GetPrefix func() (pre string) + GetQueryDB func() *sql.DB + type ILogger interface + EnableErrorLog func() bool + EnableSlowLog func() float64 + EnableSqlLog func() bool + Error func(msg string) + Slow func(sqlStr string, runtime time.Duration) + Sql func(sqlStr string, runtime time.Duration) + type IOrm interface + AddFields func(fields ...string) IOrm + BuildSql func(operType ...string) (string, []interface{}, error) + ClearBindValues func() + CrossJoin func(args ...interface{}) IOrm + Data func(data interface{}) IOrm + Distinct func() IOrm + Fields func(fields ...string) IOrm + GetBindValues func() []interface{} + GetDriver func() string + GetISession func() ISession + Group func(group string) IOrm + GroupBy func(group string) IOrm + Having func(having string) IOrm + Hello func() + Join func(args ...interface{}) IOrm + LeftJoin func(args ...interface{}) IOrm + Limit func(limit int) IOrm + LockForUpdate func() *Orm + Offset func(offset int) IOrm + OrWhere func(args ...interface{}) IOrm + OrWhereBetween func(needle string, hystack []interface{}) IOrm + OrWhereIn func(needle string, hystack []interface{}) IOrm + OrWhereNotBetween func(needle string, hystack []interface{}) IOrm + OrWhereNotIn func(needle string, hystack []interface{}) IOrm + OrWhereNotNull func(arg string) IOrm + OrWhereNull func(arg string) IOrm + Order func(order string) IOrm + OrderBy func(order string) IOrm + Page func(page int) IOrm + Reset func() IOrm + ResetUnion func() IOrm + ResetWhere func() IOrm + RightJoin func(args ...interface{}) IOrm + SetBindValues func(v interface{}) + SharedLock func() *Orm + Table func(tab interface{}) IOrm + Transaction func(closers ...func(db IOrm) error) (err error) + Where func(args ...interface{}) IOrm + WhereBetween func(needle string, hystack []interface{}) IOrm + WhereIn func(needle string, hystack []interface{}) IOrm + WhereNotBetween func(needle string, hystack []interface{}) IOrm + WhereNotIn func(needle string, hystack []interface{}) IOrm + WhereNotNull func(arg string) IOrm + WhereNull func(arg string) IOrm + type IOrmApi interface + ExtraCols func(args ...string) IOrm + GetData func() interface{} + GetDistinct func() bool + GetExtraCols func() []string + GetFields func() []string + GetGroup func() string + GetHaving func() string + GetJoin func() [][]interface{} + GetLimit func() int + GetOffset func() int + GetOrder func() string + GetPessimisticLock func() string + GetTable func() string + GetWhere func() [][]interface{} + ResetExtraCols func() IOrm + SetWhere func(arg [][]interface{}) + type IOrmExecute interface + Decrement func(args ...interface{}) (int64, error) + Delete func() (int64, error) + Force func() IOrm + GetForce func() bool + Increment func(args ...interface{}) (int64, error) + Insert func(data ...interface{}) (int64, error) + InsertGetId func(data ...interface{}) (int64, error) + Update func(data ...interface{}) (int64, error) + type IOrmQuery interface + Avg func(avg string) (interface{}, error) + Chunk func(limit int, callback func([]Data) error) (err error) + Count func(args ...string) (int64, error) + First func() (Data, error) + Get func() ([]Data, error) + Loop func(limit int, callback func([]Data) error) (err error) + Max func(max string) (interface{}, error) + Min func(min string) (interface{}, error) + Paginate func() (res Data, err error) + Pluck func(field string, fieldKey ...string) (v interface{}, err error) + Select func() error + Sum func(sum string) (interface{}, error) + Value func(field string) (v interface{}, err error) + type IOrmSession interface + Begin func() (err error) + Commit func() (err error) + Execute func(sqlstring string, args ...interface{}) (int64, error) + GetIBinder func() IBinder + GetUnion func() interface{} + LastInsertId func() int64 + LastSql func() string + Query func(sqlstring string, args ...interface{}) ([]Data, error) + Rollback func() (err error) + SetUnion func(u interface{}) + type ISession interface + Begin func() (err error) + Bind func(bind interface{}) ISession + Close func() + Commit func() (err error) + Execute func(sqlstring string, args ...interface{}) (int64, error) + GetBindAll func() []Data + GetErr func() error + GetIBinder func() IBinder + GetIEngin func() IEngin + GetTableName func() (string, error) + GetTransaction func() bool + GetUnion func() interface{} + LastInsertId func() int64 + LastSql func() string + Query func(sqlstring string, args ...interface{}) ([]Data, error) + Rollback func() (err error) + SetIBinder func(ib IBinder) + SetTransaction func(b bool) + SetUnion func(u interface{}) + Transaction func(closer ...func(session ISession) error) (err error) + func NewSession(e IEngin) ISession + type Lang uint + const CHINESE + const CHINESE_TRADITIONAL + const ENGLISH + func (l Lang) String() string + type LogLevel uint + const LOG_ERROR + const LOG_SLOW + const LOG_SQL + func (l LogLevel) String() string + type LogOption struct + EnableErrorLog bool + EnableSlowLog float64 + EnableSqlLog bool + FilePath string + type Logger struct + func NewLogger(o *LogOption) *Logger + func (l *Logger) EnableErrorLog() bool + func (l *Logger) EnableSlowLog() float64 + func (l *Logger) EnableSqlLog() bool + func (l *Logger) Error(msg string) + func (l *Logger) Slow(sqlStr string, runtime time.Duration) + func (l *Logger) Sql(sqlStr string, runtime time.Duration) + type Map t.MapString + type Orm struct + func NewOrm(e IEngin) *Orm + func (dba *Orm) AddFields(fields ...string) IOrm + func (dba *Orm) Avg(avg string) (interface{}, error) + func (dba *Orm) BuildSql(operType ...string) (a string, b []interface{}, err error) + func (dba *Orm) Chunk(limit int, callback func([]Data) error) (err error) + func (dba *Orm) ClearBindValues() + func (dba *Orm) Count(args ...string) (int64, error) + func (dba *Orm) CrossJoin(args ...interface{}) IOrm + func (dba *Orm) Data(data interface{}) IOrm + func (dba *Orm) Decrement(args ...interface{}) (int64, error) + func (dba *Orm) Delete() (int64, error) + func (dba *Orm) Distinct() IOrm + func (dba *Orm) ExtraCols(args ...string) IOrm + func (dba *Orm) Fields(fields ...string) IOrm + func (dba *Orm) First() (result Data, err error) + func (dba *Orm) Force() IOrm + func (dba *Orm) Get() (result []Data, err error) + func (dba *Orm) GetBindValues() []interface{} + func (dba *Orm) GetDriver() string + func (dba *Orm) GetExtraCols() []string + func (dba *Orm) GetForce() bool + func (dba *Orm) GetISession() ISession + func (dba *Orm) GetPessimisticLock() string + func (dba *Orm) Group(group string) IOrm + func (dba *Orm) GroupBy(group string) IOrm + func (dba *Orm) Having(having string) IOrm + func (dba *Orm) Hello() + func (dba *Orm) Increment(args ...interface{}) (int64, error) + func (dba *Orm) Insert(data ...interface{}) (int64, error) + func (dba *Orm) InsertGetId(data ...interface{}) (int64, error) + func (dba *Orm) Join(args ...interface{}) IOrm + func (dba *Orm) LeftJoin(args ...interface{}) IOrm + func (dba *Orm) Limit(limit int) IOrm + func (dba *Orm) LockForUpdate() *Orm + func (dba *Orm) Loop(limit int, callback func([]Data) error) (err error) + func (dba *Orm) Max(max string) (interface{}, error) + func (dba *Orm) Min(min string) (interface{}, error) + func (dba *Orm) Offset(offset int) IOrm + func (dba *Orm) OrWhere(args ...interface{}) IOrm + func (dba *Orm) OrWhereBetween(needle string, hystack []interface{}) IOrm + func (dba *Orm) OrWhereIn(needle string, hystack []interface{}) IOrm + func (dba *Orm) OrWhereNotBetween(needle string, hystack []interface{}) IOrm + func (dba *Orm) OrWhereNotIn(needle string, hystack []interface{}) IOrm + func (dba *Orm) OrWhereNotNull(arg string) IOrm + func (dba *Orm) OrWhereNull(arg string) IOrm + func (dba *Orm) Order(order string) IOrm + func (dba *Orm) OrderBy(order string) IOrm + func (dba *Orm) Page(page int) IOrm + func (dba *Orm) Paginate() (res Data, err error) + func (dba *Orm) Pluck(field string, fieldKey ...string) (v interface{}, err error) + func (dba *Orm) Reset() IOrm + func (dba *Orm) ResetExtraCols() IOrm + func (dba *Orm) ResetUnion() IOrm + func (dba *Orm) ResetWhere() IOrm + func (dba *Orm) RightJoin(args ...interface{}) IOrm + func (dba *Orm) Select() error + func (dba *Orm) SetBindValues(v interface{}) + func (dba *Orm) SetISession(is ISession) + func (dba *Orm) SharedLock() *Orm + func (dba *Orm) Sum(sum string) (interface{}, error) + func (dba *Orm) Table(tab interface{}) IOrm + func (dba *Orm) Update(data ...interface{}) (int64, error) + func (dba *Orm) Value(field string) (v interface{}, err error) + func (dba *Orm) Where(args ...interface{}) IOrm + func (dba *Orm) WhereBetween(needle string, hystack []interface{}) IOrm + func (dba *Orm) WhereIn(needle string, hystack []interface{}) IOrm + func (dba *Orm) WhereNotBetween(needle string, hystack []interface{}) IOrm + func (dba *Orm) WhereNotIn(needle string, hystack []interface{}) IOrm + func (dba *Orm) WhereNotNull(arg string) IOrm + func (dba *Orm) WhereNull(arg string) IOrm + func (o *Orm) GetData() interface{} + func (o *Orm) GetDistinct() bool + func (o *Orm) GetFields() []string + func (o *Orm) GetGroup() string + func (o *Orm) GetHaving() string + func (o *Orm) GetJoin() [][]interface{} + func (o *Orm) GetLimit() int + func (o *Orm) GetOffset() int + func (o *Orm) GetOrder() string + func (o *Orm) GetTable() string + func (o *Orm) GetWhere() [][]interface{} + func (o *Orm) SetWhere(arg [][]interface{}) + func (s *Orm) Transaction(closers ...func(db IOrm) error) (err error) + type OrmApi struct + type Session struct + func (s *Session) Begin() (err error) + func (s *Session) Bind(tab interface{}) ISession + func (s *Session) Close() + func (s *Session) Commit() (err error) + func (s *Session) Execute(sqlstring string, args ...interface{}) (rowsAffected int64, err error) + func (s *Session) GetErr() error + func (s *Session) GetIBinder() IBinder + func (s *Session) GetIEngin() IEngin + func (s *Session) GetTableName() (string, error) + func (s *Session) GetTransaction() bool + func (s *Session) GetUnion() interface{} + func (s *Session) LastInsertId() int64 + func (s *Session) LastSql() string + func (s *Session) Query(sqlstring string, args ...interface{}) (result []Data, err error) + func (s *Session) ResetBinderResult() + func (s *Session) Rollback() (err error) + func (s *Session) SetIBinder(ib IBinder) + func (s *Session) SetIEngin(ie IEngin) + func (s *Session) SetTransaction(b bool) + func (s *Session) SetUnion(u interface{}) + func (s *Session) Transaction(closers ...func(ses ISession) error) (err error)