Versions in this module Expand all Collapse all v0 v0.1.0 Sep 25, 2015 Changes in this version + const DEFAULT_LOG_FLAG + const DEFAULT_LOG_LEVEL + const DEFAULT_LOG_PREFIX + const Version + var ErrCacheFailed error = errors.New("Cache failed") + var ErrNeedDeletedCond error = errors.New("Delete need at least one condition") + var ErrNotExist error = errors.New("Not exist error") + var ErrNotImplemented error = errors.New("Not implemented.") + var ErrParamsType error = errors.New("Params type error") + var ErrTableNotFound error = errors.New("Not found table") + var ErrUnSupportedType error = errors.New("Unsupported type error") + var NULL_TIME time.Time + func Atot(s string, tp reflect.Type) (interface{}, error) + type AfterDeleteProcessor interface + AfterDelete func() + type AfterInsertProcessor interface + AfterInsert func() + type AfterSetProcessor interface + AfterSet func(string, Cell) + type AfterUpdateProcessor interface + AfterUpdate func() + type BeforeDeleteProcessor interface + BeforeDelete func() + type BeforeInsertProcessor interface + BeforeInsert func() + type BeforeSetProcessor interface + BeforeSet func(string, Cell) + type BeforeUpdateProcessor interface + BeforeUpdate func() + type Cell *interface + type Engine struct + Cacher core.Cacher + ColumnMapper core.IMapper + Logger core.ILogger + ShowDebug bool + ShowErr bool + ShowInfo bool + ShowSQL bool + ShowWarn bool + TZLocation *time.Location + TableMapper core.IMapper + Tables map[reflect.Type]*core.Table + TagIdentifier string + func NewEngine(driverName string, dataSourceName string) (*Engine, error) + func (engine *Engine) After(closures func(interface{})) *Session + func (engine *Engine) Alias(alias string) *Session + func (engine *Engine) AllCols() *Session + func (engine *Engine) Asc(colNames ...string) *Session + func (engine *Engine) AutoIncrStr() string + func (engine *Engine) Before(closures func(interface{})) *Session + func (engine *Engine) Cascade(trueOrFalse ...bool) *Session + func (engine *Engine) Charset(charset string) *Session + func (engine *Engine) ClearCache(beans ...interface{}) error + func (engine *Engine) ClearCacheBean(bean interface{}, id string) error + func (engine *Engine) Clone() (*Engine, error) + func (engine *Engine) Close() error + func (engine *Engine) Cols(columns ...string) *Session + func (engine *Engine) Count(bean interface{}) (int64, error) + func (engine *Engine) CreateIndexes(bean interface{}) error + func (engine *Engine) CreateTables(beans ...interface{}) error + func (engine *Engine) CreateUniques(bean interface{}) error + func (engine *Engine) DB() *core.DB + func (engine *Engine) DBMetas() ([]*core.Table, error) + func (engine *Engine) DataSourceName() string + func (engine *Engine) Decr(column string, arg ...interface{}) *Session + func (engine *Engine) Delete(bean interface{}) (int64, error) + func (engine *Engine) Desc(colNames ...string) *Session + func (engine *Engine) Dialect() core.Dialect + func (engine *Engine) Distinct(columns ...string) *Session + func (engine *Engine) DriverName() string + func (engine *Engine) DropTables(beans ...interface{}) error + func (engine *Engine) DumpAll(w io.Writer) error + func (engine *Engine) DumpAllToFile(fp string) error + func (engine *Engine) Exec(sql string, args ...interface{}) (sql.Result, error) + func (engine *Engine) Find(beans interface{}, condiBeans ...interface{}) error + func (engine *Engine) FormatTime(sqlTypeName string, t time.Time) (v interface{}) + func (engine *Engine) Get(bean interface{}) (bool, error) + func (engine *Engine) GobRegister(v interface{}) *Engine + func (engine *Engine) GroupBy(keys string) *Session + func (engine *Engine) Having(conditions string) *Session + func (engine *Engine) Id(id interface{}) *Session + func (engine *Engine) IdOf(bean interface{}) core.PK + func (engine *Engine) IdOfV(rv reflect.Value) core.PK + func (engine *Engine) Import(r io.Reader) ([]sql.Result, error) + func (engine *Engine) ImportFile(ddlPath string) ([]sql.Result, error) + func (engine *Engine) In(column string, args ...interface{}) *Session + func (engine *Engine) Incr(column string, arg ...interface{}) *Session + func (engine *Engine) Insert(beans ...interface{}) (int64, error) + func (engine *Engine) InsertOne(bean interface{}) (int64, error) + func (engine *Engine) IsTableEmpty(bean interface{}) (bool, error) + func (engine *Engine) IsTableExist(beanOrTableName interface{}) (bool, error) + func (engine *Engine) Iterate(bean interface{}, fun IterFunc) error + func (engine *Engine) Join(join_operator string, tablename interface{}, condition string) *Session + func (engine *Engine) Limit(limit int, start ...int) *Session + func (engine *Engine) LogDebug(contents ...interface{}) + func (engine *Engine) LogDebugf(format string, contents ...interface{}) + func (engine *Engine) LogError(contents ...interface{}) + func (engine *Engine) LogErrorf(format string, contents ...interface{}) + func (engine *Engine) LogInfo(contents ...interface{}) + func (engine *Engine) LogInfof(format string, contents ...interface{}) + func (engine *Engine) LogSQLExecutionTime(sqlStr string, args interface{}, executionBlock func() (sql.Result, error)) (sql.Result, error) + func (engine *Engine) LogSQLQueryTime(sqlStr string, args interface{}, ...) (*core.Stmt, *core.Rows, error) + func (engine *Engine) LogWarn(contents ...interface{}) + func (engine *Engine) LogWarnf(format string, contents ...interface{}) + func (engine *Engine) MapCacher(bean interface{}, cacher core.Cacher) + func (engine *Engine) MustCols(columns ...string) *Session + func (engine *Engine) NewDB() (*core.DB, error) + func (engine *Engine) NewSession() *Session + func (engine *Engine) NoAutoTime() *Session + func (engine *Engine) NoCache() *Session + func (engine *Engine) NoCascade() *Session + func (engine *Engine) NowTime(sqlTypeName string) interface{} + func (engine *Engine) NowTime2(sqlTypeName string) (interface{}, time.Time) + func (engine *Engine) Nullable(columns ...string) *Session + func (engine *Engine) Omit(columns ...string) *Session + func (engine *Engine) OrderBy(order string) *Session + func (engine *Engine) Ping() error + func (engine *Engine) Query(sql string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error) + func (engine *Engine) Quote(sql string) string + func (engine *Engine) QuoteStr() string + func (engine *Engine) Rows(bean interface{}) (*Rows, error) + func (engine *Engine) Select(str string) *Session + func (engine *Engine) SetColumnMapper(mapper core.IMapper) + func (engine *Engine) SetDefaultCacher(cacher core.Cacher) + func (engine *Engine) SetDisableGlobalCache(disable bool) + func (engine *Engine) SetExpr(column string, expression string) *Session + func (engine *Engine) SetLogger(logger core.ILogger) + func (engine *Engine) SetMapper(mapper core.IMapper) + func (engine *Engine) SetMaxConns(conns int) + func (engine *Engine) SetMaxIdleConns(conns int) + func (engine *Engine) SetMaxOpenConns(conns int) + func (engine *Engine) SetTableMapper(mapper core.IMapper) + func (engine *Engine) Sql(querystring string, args ...interface{}) *Session + func (engine *Engine) SqlType(c *core.Column) string + func (engine *Engine) StoreEngine(storeEngine string) *Session + func (engine *Engine) SupportInsertMany() bool + func (engine *Engine) Sync(beans ...interface{}) error + func (engine *Engine) Sync2(beans ...interface{}) error + func (engine *Engine) TZTime(t time.Time) time.Time + func (engine *Engine) Table(tableNameOrBean interface{}) *Session + func (engine *Engine) TableInfo(bean interface{}) *core.Table + func (engine *Engine) Unscoped() *Session + func (engine *Engine) Update(bean interface{}, condiBeans ...interface{}) (int64, error) + func (engine *Engine) UseBool(columns ...string) *Session + func (engine *Engine) Where(querystring string, args ...interface{}) *Session + type IterFunc func(idx int, bean interface{}) error + type LRUCacher struct + Expired time.Duration + GcInterval time.Duration + MaxElementSize int + func NewLRUCacher(store core.CacheStore, maxElementSize int) *LRUCacher + func NewLRUCacher2(store core.CacheStore, expired time.Duration, maxElementSize int) *LRUCacher + func (m *LRUCacher) ClearBeans(tableName string) + func (m *LRUCacher) ClearIds(tableName string) + func (m *LRUCacher) DelBean(tableName string, id string) + func (m *LRUCacher) DelIds(tableName, sql string) + func (m *LRUCacher) GC() + func (m *LRUCacher) GetBean(tableName string, id string) interface{} + func (m *LRUCacher) GetIds(tableName, sql string) interface{} + func (m *LRUCacher) PutBean(tableName string, id string, obj interface{}) + func (m *LRUCacher) PutIds(tableName, sql string, ids interface{}) + func (m *LRUCacher) RunGC() + type MemoryStore struct + func NewMemoryStore() *MemoryStore + func (s *MemoryStore) Del(key string) error + func (s *MemoryStore) Get(key string) (interface{}, error) + func (s *MemoryStore) Put(key string, value interface{}) error + type Rows struct + NoTypeCheck bool + func (rows *Rows) Close() error + func (rows *Rows) Err() error + func (rows *Rows) Next() bool + func (rows *Rows) Scan(bean interface{}) error + type Session struct + AutoResetStatement bool + Engine *Engine + IsAutoClose bool + IsAutoCommit bool + IsCommitedOrRollbacked bool + Statement Statement + TransType string + Tx *core.Tx + func (s *Session) Sync2(beans ...interface{}) error + func (session *Session) After(closures func(interface{})) *Session + func (session *Session) Alias(alias string) *Session + func (session *Session) AllCols() *Session + func (session *Session) And(querystring string, args ...interface{}) *Session + func (session *Session) Asc(colNames ...string) *Session + func (session *Session) Before(closures func(interface{})) *Session + func (session *Session) Begin() error + func (session *Session) Cascade(trueOrFalse ...bool) *Session + func (session *Session) Charset(charset string) *Session + func (session *Session) Close() + func (session *Session) Cols(columns ...string) *Session + func (session *Session) Commit() error + func (session *Session) Count(bean interface{}) (int64, error) + func (session *Session) CreateIndexes(bean interface{}) error + func (session *Session) CreateTable(bean interface{}) error + func (session *Session) CreateUniques(bean interface{}) error + func (session *Session) DB() *core.DB + func (session *Session) Decr(column string, arg ...interface{}) *Session + func (session *Session) Delete(bean interface{}) (int64, error) + func (session *Session) Desc(colNames ...string) *Session + func (session *Session) Distinct(columns ...string) *Session + func (session *Session) DropIndexes(bean interface{}) error + func (session *Session) DropTable(beanOrTableName interface{}) error + func (session *Session) Exec(sqlStr string, args ...interface{}) (sql.Result, error) + func (session *Session) Find(rowsSlicePtr interface{}, condiBean ...interface{}) error + func (session *Session) Get(bean interface{}) (bool, error) + func (session *Session) GroupBy(keys string) *Session + func (session *Session) Having(conditions string) *Session + func (session *Session) Id(id interface{}) *Session + func (session *Session) In(column string, args ...interface{}) *Session + func (session *Session) Incr(column string, arg ...interface{}) *Session + func (session *Session) Init() + func (session *Session) Insert(beans ...interface{}) (int64, error) + func (session *Session) InsertMulti(rowsSlicePtr interface{}) (int64, error) + func (session *Session) InsertOne(bean interface{}) (int64, error) + func (session *Session) IsTableEmpty(bean interface{}) (bool, error) + func (session *Session) IsTableExist(beanOrTableName interface{}) (bool, error) + func (session *Session) Iterate(bean interface{}, fun IterFunc) error + func (session *Session) Join(join_operator string, tablename interface{}, condition string) *Session + func (session *Session) LastSQL() (string, []interface{}) + func (session *Session) Limit(limit int, start ...int) *Session + func (session *Session) MustCols(columns ...string) *Session + func (session *Session) NoAutoTime() *Session + func (session *Session) NoCache() *Session + func (session *Session) NoCascade() *Session + func (session *Session) Nullable(columns ...string) *Session + func (session *Session) Omit(columns ...string) *Session + func (session *Session) Or(querystring string, args ...interface{}) *Session + func (session *Session) OrderBy(order string) *Session + func (session *Session) Ping() error + func (session *Session) Query(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error) + func (session *Session) Rollback() error + func (session *Session) Rows(bean interface{}) (*Rows, error) + func (session *Session) Select(str string) *Session + func (session *Session) SetExpr(column string, expression string) *Session + func (session *Session) Sql(querystring string, args ...interface{}) *Session + func (session *Session) StoreEngine(storeEngine string) *Session + func (session *Session) Table(tableNameOrBean interface{}) *Session + func (session *Session) Unscoped() *Session + func (session *Session) Update(bean interface{}, condiBean ...interface{}) (int64, error) + func (session *Session) UseBool(columns ...string) *Session + func (session *Session) Where(querystring string, args ...interface{}) *Session + type SimpleLogger struct + DEBUG *log.Logger + ERR *log.Logger + INFO *log.Logger + WARN *log.Logger + func NewSimpleLogger(out io.Writer) *SimpleLogger + func NewSimpleLogger2(out io.Writer, prefix string, flag int) *SimpleLogger + func NewSimpleLogger3(out io.Writer, prefix string, flag int, l core.LogLevel) *SimpleLogger + func (s *SimpleLogger) Debug(v ...interface{}) (err error) + func (s *SimpleLogger) Debugf(format string, v ...interface{}) (err error) + func (s *SimpleLogger) Err(v ...interface{}) (err error) + func (s *SimpleLogger) Errf(format string, v ...interface{}) (err error) + func (s *SimpleLogger) Info(v ...interface{}) (err error) + func (s *SimpleLogger) Infof(format string, v ...interface{}) (err error) + func (s *SimpleLogger) Level() core.LogLevel + func (s *SimpleLogger) SetLevel(l core.LogLevel) (err error) + func (s *SimpleLogger) Warning(v ...interface{}) (err error) + func (s *SimpleLogger) Warningf(format string, v ...interface{}) (err error) + type Statement struct + AltTableName string + BeanArgs []interface{} + Charset string + ColumnStr string + ConditionStr string + Engine *Engine + GroupByStr string + HavingStr string + IdParam *core.PK + IsDistinct bool + JoinStr string + LimitN int + OmitStr string + OrderStr string + Params []interface{} + RawParams []interface{} + RawSQL string + RefTable *core.Table + Start int + StoreEngine string + TableAlias string + UseAutoJoin bool + UseAutoTime bool + UseCache bool + UseCascade bool + WhereStr string + func (s *Statement) Select(str string) *Statement + func (statement *Statement) Alias(alias string) *Statement + func (statement *Statement) AllCols() *Statement + func (statement *Statement) And(querystring string, args ...interface{}) *Statement + func (statement *Statement) Asc(colNames ...string) *Statement + func (statement *Statement) Cols(columns ...string) *Statement + func (statement *Statement) Decr(column string, arg ...interface{}) *Statement + func (statement *Statement) Desc(colNames ...string) *Statement + func (statement *Statement) Distinct(columns ...string) *Statement + func (statement *Statement) GroupBy(keys string) *Statement + func (statement *Statement) Having(conditions string) *Statement + func (statement *Statement) Id(id interface{}) *Statement + func (statement *Statement) In(column string, args ...interface{}) *Statement + func (statement *Statement) Incr(column string, arg ...interface{}) *Statement + func (statement *Statement) Init() + func (statement *Statement) Join(join_operator string, tablename interface{}, condition string) *Statement + func (statement *Statement) JoinColumns(cols []*core.Column, includeTableName bool) string + func (statement *Statement) Limit(limit int, start ...int) *Statement + func (statement *Statement) MustCols(columns ...string) *Statement + func (statement *Statement) Nullable(columns ...string) + func (statement *Statement) Omit(columns ...string) + func (statement *Statement) Or(querystring string, args ...interface{}) *Statement + func (statement *Statement) OrderBy(order string) *Statement + func (statement *Statement) SetExpr(column string, expression string) *Statement + func (statement *Statement) Sql(querystring string, args ...interface{}) *Statement + func (statement *Statement) Table(tableNameOrBean interface{}) *Statement + func (statement *Statement) TableName() string + func (statement *Statement) Top(limit int) *Statement + func (statement *Statement) Unscoped() *Statement + func (statement *Statement) UseBool(columns ...string) *Statement + func (statement *Statement) Where(querystring string, args ...interface{}) *Statement + type SyslogLogger struct — darwin/amd64, js/wasm, linux/amd64 + func NewSyslogLogger(w *syslog.Writer) *SyslogLogger + func (s *SyslogLogger) Debug(v ...interface{}) (err error) + func (s *SyslogLogger) Debugf(format string, v ...interface{}) (err error) + func (s *SyslogLogger) Err(v ...interface{}) (err error) + func (s *SyslogLogger) Errf(format string, v ...interface{}) (err error) + func (s *SyslogLogger) Info(v ...interface{}) (err error) + func (s *SyslogLogger) Infof(format string, v ...interface{}) (err error) + func (s *SyslogLogger) Level() core.LogLevel + func (s *SyslogLogger) SetLevel(l core.LogLevel) (err error) + func (s *SyslogLogger) Warning(v ...interface{}) (err error) + func (s *SyslogLogger) Warningf(format string, v ...interface{}) (err error)