Versions in this module Expand all Collapse all v0 v0.4.1 Nov 5, 2014 Changes in this version + const DEFAULT_LOG_FLAG + const DEFAULT_LOG_LEVEL + const DEFAULT_LOG_PREFIX + var NULL_TIME time.Time + type BeforeSetProcessor interface + BeforeSet func(string, Cell) + type Cell *interface type Engine + ColumnMapper core.IMapper + ShowInfo bool + TZLocation *time.Location + TableMapper core.IMapper + func (engine *Engine) Clone() (*Engine, error) + func (engine *Engine) DB() *core.DB + func (engine *Engine) Decr(column string, arg ...interface{}) *Session + func (engine *Engine) Dialect() core.Dialect + func (engine *Engine) DumpAll(w io.Writer) error + func (engine *Engine) DumpAllToFile(fp string) error + func (engine *Engine) GobRegister(v interface{}) *Engine + func (engine *Engine) IdOf(bean interface{}) core.PK + func (engine *Engine) ImportFile(ddlPath string) ([]sql.Result, error) + func (engine *Engine) Incr(column string, arg ...interface{}) *Session + func (engine *Engine) LogDebugf(format string, 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) LogWarnf(format string, contents ...interface{}) + func (engine *Engine) NewDB() (*core.DB, error) + func (engine *Engine) SetDisableGlobalCache(disable bool) + func (engine *Engine) SetMaxOpenConns(conns int) + func (engine *Engine) Sync2(beans ...interface{}) error + func (engine *Engine) TableInfo(bean interface{}) *core.Table + func (engine *Engine) Unscoped() *Session type LRUCacher + MaxElementSize int type Session + AutoResetStatement bool + func (s *Session) Sync2(beans ...interface{}) error + func (session *Session) Decr(column string, arg ...interface{}) *Session + func (session *Session) Incr(column string, arg ...interface{}) *Session + func (session *Session) Q(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string]string, err error) + func (session *Session) Unscoped() *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 + func (statement *Statement) Asc(colNames ...string) *Statement + func (statement *Statement) Decr(column string, arg ...interface{}) *Statement + func (statement *Statement) Desc(colNames ...string) *Statement + func (statement *Statement) Incr(column string, arg ...interface{}) *Statement + func (statement *Statement) Unscoped() *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) v0.3.2 Apr 16, 2014 Changes in this version + const CacheExpired + const CacheGcInterval + const CacheGcMaxRemoved + const CacheMaxMemory + const IndexType + const MSSQL + const MYMYSQL + const MYSQL + const ONLYFROMDB + const ONLYTODB + const ORACLE_OCI + const POSTGRES + const QL + const SQLITE + const TWOSIDES + const UniqueType + const Version + var BigInt = "BIGINT" + var BigSerial = "BIGSERIAL" + var Binary = "BINARY" + var Bit = "BIT" + var Blob = "BLOB" + var Bool = "BOOL" + var Bytea = "BYTEA" + var Char = "CHAR" + var Date = "DATE" + var DateTime = "DATETIME" + var Decimal = "DECIMAL" + var Double = "DOUBLE" + 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 Float = "FLOAT" + var Int = "INT" + var Integer = "INTEGER" + var LongBlob = "LONGBLOB" + var LongText = "LONGTEXT" + var MediumBlob = "MEDIUMBLOB" + var MediumInt = "MEDIUMINT" + var MediumText = "MEDIUMTEXT" + var Numeric = "NUMERIC" + var Real = "REAL" + var Serial = "SERIAL" + var SmallInt = "SMALLINT" + var Text = "TEXT" + var Time = "TIME" + var TimeStamp = "TIMESTAMP" + var TimeStampz = "TIMESTAMPZ" + var TinyBlob = "TINYBLOB" + var TinyInt = "TINYINT" + var TinyText = "TINYTEXT" + var VarBinary = "VARBINARY" + var Varchar = "VARCHAR" + func SQLType2Type(st SQLType) reflect.Type + type AfterDeleteProcessor interface + AfterDelete func() + type AfterInsertProcessor interface + AfterInsert func() + type AfterUpdateProcessor interface + AfterUpdate func() + type BeforeDeleteProcessor interface + BeforeDelete func() + type BeforeInsertProcessor interface + BeforeInsert func() + type BeforeUpdateProcessor interface + BeforeUpdate func() + type CacheMapper struct + func NewCacheMapper(mapper IMapper) *CacheMapper + func (m *CacheMapper) Obj2Table(o string) string + func (m *CacheMapper) Table2Obj(t string) string + type CacheStore interface + Del func(key interface{}) error + Get func(key interface{}) (interface{}, error) + Put func(key, value interface{}) error + type Cacher interface + ClearBeans func(tableName string) + ClearIds func(tableName string) + DelBean func(tableName string, id int64) + DelIds func(tableName, sql string) + GetBean func(tableName string, id int64) interface{} + GetIds func(tableName, sql string) interface{} + PutBean func(tableName string, id int64, obj interface{}) + PutIds func(tableName, sql string, ids interface{}) + type Column struct + Default string + DefaultIsEmpty bool + FieldName string + Indexes map[string]bool + IsAutoIncrement bool + IsCascade bool + IsCreated bool + IsPrimaryKey bool + IsUpdated bool + IsVersion bool + Length int + Length2 int + MapType int + Name string + Nullable bool + SQLType SQLType + func (col *Column) String(d dialect) string + func (col *Column) ValueOf(bean interface{}) reflect.Value + type Conversion interface + FromDB func([]byte) error + ToDB func() ([]byte, error) + type Engine struct + Cacher Cacher + DataSourceName string + DriverName string + Filters []Filter + Logger io.Writer + Pool IConnectPool + ShowDebug bool + ShowErr bool + ShowSQL bool + ShowWarn bool + Tables map[reflect.Type]*Table + TagIdentifier string + TimeZone string + UseCache bool + func NewEngine(driverName string, dataSourceName string) (*Engine, error) + func (engine *Engine) After(closures func(interface{})) *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 int64) 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) DBMetas() ([]*Table, error) + func (engine *Engine) Delete(bean interface{}) (int64, error) + func (engine *Engine) Desc(colNames ...string) *Session + func (engine *Engine) Distinct(columns ...string) *Session + func (engine *Engine) DropTables(beans ...interface{}) 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) GroupBy(keys string) *Session + func (engine *Engine) Having(conditions string) *Session + func (engine *Engine) Id(id interface{}) *Session + func (engine *Engine) Import(ddlPath string) ([]sql.Result, error) + func (engine *Engine) In(column string, args ...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(bean interface{}) (bool, error) + func (engine *Engine) Iterate(bean interface{}, fun IterFunc) error + func (engine *Engine) Join(join_operator, tablename, condition string) *Session + func (engine *Engine) Limit(limit int, start ...int) *Session + func (engine *Engine) LogDebug(contents ...interface{}) + func (engine *Engine) LogError(contents ...interface{}) + func (engine *Engine) LogSQL(contents ...interface{}) + func (engine *Engine) LogWarn(contents ...interface{}) + func (engine *Engine) MapCacher(bean interface{}, cacher Cacher) + func (engine *Engine) MustCols(columns ...string) *Session + 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) Omit(columns ...string) *Session + func (engine *Engine) OpenDB() (*sql.DB, error) + 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) SetColumnMapper(mapper IMapper) + func (engine *Engine) SetDefaultCacher(cacher Cacher) + func (engine *Engine) SetMapper(mapper IMapper) + func (engine *Engine) SetMaxConns(conns int) + func (engine *Engine) SetMaxIdleConns(conns int) + func (engine *Engine) SetPool(pool IConnectPool) error + func (engine *Engine) SetTableMapper(mapper IMapper) + func (engine *Engine) Sql(querystring string, args ...interface{}) *Session + func (engine *Engine) SqlType(c *Column) string + func (engine *Engine) StoreEngine(storeEngine string) *Session + func (engine *Engine) SupportInsertMany() bool + func (engine *Engine) Sync(beans ...interface{}) error + func (engine *Engine) TZTime(t time.Time) (r time.Time) + func (engine *Engine) Table(tableNameOrBean interface{}) *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 Filter interface + Do func(sql string, session *Session) string + type IConnectPool interface + Close func(engine *Engine) error + Init func(engine *Engine) error + MaxConns func() int + MaxIdleConns func() int + ReleaseDB func(engine *Engine, db *sql.DB) + RetrieveDB func(engine *Engine) (*sql.DB, error) + SetMaxConns func(conns int) + SetMaxIdleConns func(conns int) + func NewNoneConnectPool() IConnectPool + func NewSimpleConnectPool() IConnectPool + func NewSysConnectPool() IConnectPool + type IMapper interface + Obj2Table func(string) string + Table2Obj func(string) string + type IdFilter struct + func (i *IdFilter) Do(sql string, session *Session) string + type Index struct + Cols []string + Name string + Type int + func NewIndex(name string, indexType int) *Index + func (index *Index) AddColumn(cols ...string) + type IterFunc func(idx int, bean interface{}) error + type LRUCacher struct + Expired time.Duration + GcInterval time.Duration + Max int + func NewLRUCacher(store CacheStore, max int) *LRUCacher + func NewLRUCacher2(store CacheStore, expired time.Duration, max int) *LRUCacher + func (m *LRUCacher) ClearBeans(tableName string) + func (m *LRUCacher) ClearIds(tableName string) + func (m *LRUCacher) DelBean(tableName string, id int64) + func (m *LRUCacher) DelIds(tableName, sql string) + func (m *LRUCacher) GC() + func (m *LRUCacher) GetBean(tableName string, id int64) interface{} + func (m *LRUCacher) GetIds(tableName, sql string) interface{} + func (m *LRUCacher) PutBean(tableName string, id int64, 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 interface{}) error + func (s *MemoryStore) Get(key interface{}) (interface{}, error) + func (s *MemoryStore) Put(key, value interface{}) error + type NoneConnectPool struct + func (p *NoneConnectPool) Close(engine *Engine) error + func (p *NoneConnectPool) Init(engine *Engine) error + func (p *NoneConnectPool) MaxConns() int + func (p *NoneConnectPool) MaxIdleConns() int + func (p *NoneConnectPool) ReleaseDB(engine *Engine, db *sql.DB) + func (p *NoneConnectPool) RetrieveDB(engine *Engine) (db *sql.DB, err error) + func (p *NoneConnectPool) SetMaxConns(conns int) + func (p *NoneConnectPool) SetMaxIdleConns(conns int) + type PK []interface + type PgSeqFilter struct + func (s *PgSeqFilter) Do(sql string, session *Session) string + type PrefixMapper struct + Mapper IMapper + Prefix string + func NewPrefixMapper(mapper IMapper, prefix string) PrefixMapper + func (mapper PrefixMapper) Obj2Table(name string) string + func (mapper PrefixMapper) Table2Obj(name string) string + type QuoteFilter struct + func (s *QuoteFilter) Do(sql string, session *Session) string + 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 SQLType struct + DefaultLength int + DefaultLength2 int + Name string + func Type2SQLType(t reflect.Type) (st SQLType) + func (s *SQLType) IsBlob() bool + func (s *SQLType) IsText() bool + type SameMapper struct + func (m SameMapper) Obj2Table(o string) string + func (m SameMapper) Table2Obj(t string) string + type Session struct + Db *sql.DB + Engine *Engine + IsAutoClose bool + IsAutoCommit bool + IsCommitedOrRollbacked bool + Statement Statement + TransType string + Tx *sql.Tx + func (session *Session) After(closures func(interface{})) *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) 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(bean 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) 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) Iterate(bean interface{}, fun IterFunc) error + func (session *Session) Join(join_operator, tablename, condition string) *Session + 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) 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) Sql(querystring string, args ...interface{}) *Session + func (session *Session) StoreEngine(storeEngine string) *Session + func (session *Session) Table(tableNameOrBean interface{}) *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 SimpleConnectPool struct + func (p *SimpleConnectPool) Close(engine *Engine) error + func (p *SimpleConnectPool) MaxConns() int + func (p *SimpleConnectPool) MaxIdleConns() int + func (p *SimpleConnectPool) ReleaseDB(engine *Engine, db *sql.DB) + func (p *SimpleConnectPool) RetrieveDB(engine *Engine) (*sql.DB, error) + func (p *SimpleConnectPool) SetMaxConns(conns int) + func (p *SimpleConnectPool) SetMaxIdleConns(conns int) + func (s *SimpleConnectPool) Init(engine *Engine) error + type SnakeMapper struct + func (mapper SnakeMapper) Obj2Table(name string) string + func (mapper SnakeMapper) Table2Obj(name string) string + type Statement struct + AltTableName string + BeanArgs []interface{} + Charset string + ColumnStr string + ConditionStr string + Engine *Engine + GroupByStr string + HavingStr string + IdParam *PK + IsDistinct bool + JoinStr string + LimitN int + OmitStr string + OrderStr string + Params []interface{} + RawParams []interface{} + RawSQL string + RefTable *Table + Start int + StoreEngine string + UseAutoJoin bool + UseAutoTime bool + UseCache bool + UseCascade bool + WhereStr string + func (statement *Statement) AllCols() *Statement + func (statement *Statement) And(querystring string, args ...interface{}) *Statement + func (statement *Statement) Cols(columns ...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) Init() + func (statement *Statement) Join(join_operator, tablename, condition string) *Statement + func (statement *Statement) Limit(limit int, start ...int) *Statement + func (statement *Statement) MustCols(columns ...string) *Statement + 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) 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) UseBool(columns ...string) *Statement + func (statement *Statement) Where(querystring string, args ...interface{}) *Statement + type SuffixMapper struct + Mapper IMapper + Suffix string + func NewSuffixMapper(mapper IMapper, suffix string) SuffixMapper + func (mapper SuffixMapper) Obj2Table(name string) string + func (mapper SuffixMapper) Table2Obj(name string) string + type SysConnectPool struct + func (p *SysConnectPool) Close(engine *Engine) error + func (p *SysConnectPool) MaxConns() int + func (p *SysConnectPool) MaxIdleConns() int + func (p *SysConnectPool) SetMaxConns(conns int) + func (p *SysConnectPool) SetMaxIdleConns(conns int) + func (s *SysConnectPool) Init(engine *Engine) error + func (s *SysConnectPool) ReleaseDB(engine *Engine, db *sql.DB) + func (s *SysConnectPool) RetrieveDB(engine *Engine) (db *sql.DB, err error) + type Table struct + AutoIncrement string + Cacher Cacher + Columns map[string]*Column + ColumnsSeq []string + Created map[string]bool + Indexes map[string]*Index + Name string + PrimaryKeys []string + Type reflect.Type + Updated string + Version string + func (table *Table) AddColumn(col *Column) + func (table *Table) AddIndex(index *Index) + func (table *Table) AutoIncrColumn() *Column + func (table *Table) PKColumns() []*Column + func (table *Table) VersionColumn() *Column v0.3.1 Jan 2, 2014 v0.2.3 Nov 29, 2013 v0.2.2 Nov 6, 2013 v0.2.1 Oct 15, 2013