Documentation ¶
Overview ¶
Package xorm is a simple and powerful ORM for Go.
Installation ¶
Make sure you have installed Go 1.1+ and then:
go get github.com/coscms/xorm
Create Engine ¶
Firstly, we should new an engine for a database
engine, err := xorm.NewEngine(driverName, dataSourceName)
Method NewEngine's parameters is the same as sql.Open. It depends drivers' implementation. Generally, one engine for an application is enough. You can set it as package variable.
Raw Methods ¶
Xorm also support raw sql execution:
1. query a SQL string, the returned results is []map[string][]byte
results, err := engine.Query("select * from user")
2. execute a SQL string, the returned results
affected, err := engine.Exec("update user set .... where ...")
ORM Methods ¶
There are 7 major ORM methods and many helpful methods to use to operate database.
1. Insert one or multipe records to database
affected, err := engine.Insert(&struct) // INSERT INTO struct () values () affected, err := engine.Insert(&struct1, &struct2) // INSERT INTO struct1 () values () // INSERT INTO struct2 () values () affected, err := engine.Insert(&sliceOfStruct) // INSERT INTO struct () values (),(),() affected, err := engine.Insert(&struct1, &sliceOfStruct2) // INSERT INTO struct1 () values () // INSERT INTO struct2 () values (),(),()
2. Query one record from database
has, err := engine.Get(&user) // SELECT * FROM user LIMIT 1
3. Query multiple records from database
sliceOfStructs := new(Struct) err := engine.Find(sliceOfStructs) // SELECT * FROM user
4. Query multiple records and record by record handle, there two methods, one is Iterate, another is Rows
err := engine.Iterate(...) // SELECT * FROM user rows, err := engine.Rows(...) // SELECT * FROM user defer rows.Close() bean := new(Struct) for rows.Next() { err = rows.Scan(bean) }
5. Update one or more records
affected, err := engine.Id(...).Update(&user) // UPDATE user SET ...
6. Delete one or more records, Delete MUST has conditon
affected, err := engine.Where(...).Delete(&user) // DELETE FROM user Where ...
7. Count records
counts, err := engine.Count(&user) // SELECT count(*) AS total FROM user
Conditions ¶
The above 7 methods could use with condition methods chainable. Attention: the above 7 methods should be the last chainable method.
1. Id, In
engine.Id(1).Get(&user) // for single primary key // SELECT * FROM user WHERE id = 1 engine.Id(core.PK{1, 2}).Get(&user) // for composite primary keys // SELECT * FROM user WHERE id1 = 1 AND id2 = 2 engine.In("id", 1, 2, 3).Find(&users) // SELECT * FROM user WHERE id IN (1, 2, 3) engine.In("id", []int{1, 2, 3}) // SELECT * FROM user WHERE id IN (1, 2, 3)
2. Where, And, Or
engine.Where().And().Or().Find() // SELECT * FROM user WHERE (.. AND ..) OR ...
3. OrderBy, Asc, Desc
engine.Asc().Desc().Find() // SELECT * FROM user ORDER BY .. ASC, .. DESC engine.OrderBy().Find() // SELECT * FROM user ORDER BY ..
4. Limit, Top
engine.Limit().Find() // SELECT * FROM user LIMIT .. OFFSET .. engine.Top(5).Find() // SELECT TOP 5 * FROM user // for mssql // SELECT * FROM user LIMIT .. OFFSET 0 //for other databases
5. Sql, let you custom SQL
var users []User engine.Sql("select * from user").Find(&users)
6. Cols, Omit, Distinct
var users []*User engine.Cols("col1, col2").Find(&users) // SELECT col1, col2 FROM user engine.Cols("col1", "col2").Where().Update(user) // UPDATE user set col1 = ?, col2 = ? Where ... engine.Omit("col1").Find(&users) // SELECT col2, col3 FROM user engine.Omit("col1").Insert(&user) // INSERT INTO table (non-col1) VALUES () engine.Distinct("col1").Find(&users) // SELECT DISTINCT col1 FROM user
7. Join, GroupBy, Having
engine.GroupBy("name").Having("name='xlw'").Find(&users) //SELECT * FROM user GROUP BY name HAVING name='xlw' engine.Join("LEFT", "userdetail", "user.id=userdetail.id").Find(&users) //SELECT * FROM user LEFT JOIN userdetail ON user.id=userdetail.id
More usage, please visit http://xorm.io/docs
Index ¶
- Constants
- Variables
- func AddCSlashes(s string, b ...rune) string
- func AddSlashes(s string, args ...rune) string
- func BuildSqlResult(sqlStr string, args interface{}) string
- func NewJoinParam(stmt *Statement) *joinParam
- func RowProcessing(rows *core.Rows, fields []string, ...) (err error)
- func StrRowProcessing(rows *core.Rows, fields []string, ...) (err error)
- type AdmpubLogger
- type AfterDeleteProcessor
- type AfterInsertProcessor
- type AfterSetProcessor
- type AfterUpdateProcessor
- type BeforeDeleteProcessor
- type BeforeInsertProcessor
- type BeforeSetProcessor
- type BeforeUpdateProcessor
- type CLogger
- func (c *CLogger) Debug(v ...interface{})
- func (c *CLogger) Debugf(format string, v ...interface{})
- func (c *CLogger) Error(v ...interface{})
- func (c *CLogger) Errorf(format string, v ...interface{})
- func (c *CLogger) Info(v ...interface{})
- func (c *CLogger) Infof(format string, v ...interface{})
- func (c *CLogger) Warn(v ...interface{})
- func (c *CLogger) Warnf(format string, v ...interface{})
- type Cell
- type DiscardLogger
- func (DiscardLogger) Debug(v ...interface{})
- func (DiscardLogger) Debugf(format string, v ...interface{})
- func (DiscardLogger) Error(v ...interface{})
- func (DiscardLogger) Errorf(format string, v ...interface{})
- func (DiscardLogger) Info(v ...interface{})
- func (DiscardLogger) Infof(format string, v ...interface{})
- func (DiscardLogger) IsShowSQL() bool
- func (DiscardLogger) Level() core.LogLevel
- func (DiscardLogger) SetLevel(l core.LogLevel)
- func (DiscardLogger) ShowSQL(show ...bool)
- func (DiscardLogger) Warn(v ...interface{})
- func (DiscardLogger) Warnf(format string, v ...interface{})
- type Engine
- 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) CloseLog(types ...string)
- 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) DropIndexes(bean interface{}) error
- 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) DumpTables(tables []*core.Table, w io.Writer, tp ...core.DbType) error
- func (engine *Engine) DumpTablesToFile(tables []*core.Table, fp string, tp ...core.DbType) 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 (this *Engine) GetOne(sql string, params ...interface{}) (result string)
- func (this *Engine) GetRow(sql string, params ...interface{}) (result *ResultSet)
- func (this *Engine) GetRows(sql string, params ...interface{}) []*ResultSet
- 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) 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) Init()
- func (engine *Engine) Insert(beans ...interface{}) (int64, error)
- func (engine *Engine) InsertMulti(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(joinOperator string, tablename interface{}, condition string, ...) *Session
- func (engine *Engine) Limit(limit int, start ...int) *Session
- func (engine *Engine) Logger() core.ILogger
- 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) NoAutoCondition(no ...bool) *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) OpenLog(types ...string)
- 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 (this *Engine) QueryRaw(sql string, params ...interface{}) []map[string]interface{}
- func (this *Engine) QueryStr(sql string, params ...interface{}) []map[string]string
- func (engine *Engine) Quote(sql string) string
- func (this *Engine) QuoteKey(s string) string
- func (engine *Engine) QuoteStr() string
- func (this *Engine) QuoteValue(s string) string
- func (engine *Engine) QuoteWithDelim(s, d string) string
- func (this *Engine) RawBatchInsert(table string, multiSets []map[string]interface{}) (stdSQL.Result, error)
- func (this *Engine) RawDelete(table string, where string, params ...interface{}) (int64, error)
- func (this *Engine) RawExec(sql string, retId bool, params ...interface{}) (affected int64, err error)
- func (this *Engine) RawExecr(sql string, params ...interface{}) (result stdSQL.Result, err error)
- func (this *Engine) RawFetch(fields string, table string, where string, params ...interface{}) (result map[string]string)
- func (this *Engine) RawFetchAll(fields string, table string, where string, params ...interface{}) []map[string]string
- func (this *Engine) RawInsert(table string, sets map[string]interface{}) (lastId int64, err error)
- func (this *Engine) RawOnlyInsert(table string, sets map[string]interface{}) (stdSQL.Result, error)
- func (this *Engine) RawQuery(sql string, params ...interface{}) (resultsSlice []*ResultSet, err error)
- func (this *Engine) RawQueryAllKvs(key string, sql string, params ...interface{}) map[string][]map[string]string
- func (this *Engine) RawQueryCallback(callback func(*core.Rows, []string), sql string, params ...interface{}) (err error)
- func (this *Engine) RawQueryKv(key string, val string, sql string, params ...interface{}) map[string]string
- func (this *Engine) RawQueryKvs(key string, sql string, params ...interface{}) map[string]map[string]string
- func (this *Engine) RawQueryStr(sql string, params ...interface{}) []map[string]string
- func (this *Engine) RawReplace(table string, sets map[string]interface{}) (int64, error)
- func (this *Engine) RawSelect(fields string, table string, where string, params ...interface{}) SelectRows
- func (this *Engine) RawUpdate(table string, sets map[string]interface{}, where string, args ...interface{}) (int64, error)
- func (this *Engine) ReplaceTablePrefix(sql string) (r string)
- func (engine *Engine) Rows(bean interface{}) (*Rows, error)
- func (engine *Engine) SQL(query interface{}, args ...interface{}) *Session
- func (engine *Engine) SQLType(c *core.Column) string
- 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) SetMaxIdleConns(conns int)
- func (engine *Engine) SetMaxOpenConns(conns int)
- func (engine *Engine) SetTableMapper(mapper core.IMapper)
- func (engine *Engine) SetTblMapper(mapper core.IMapper)
- func (engine *Engine) ShowExecTime(show ...bool)
- func (engine *Engine) ShowSQL(show ...bool)
- 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) Sum(bean interface{}, colName string) (float64, error)
- func (engine *Engine) Sums(bean interface{}, colNames ...string) ([]float64, error)
- func (engine *Engine) SumsInt(bean interface{}, colNames ...string) ([]int64, error)
- 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{}) *Table
- func (this *Engine) TableName(table string) string
- func (engine *Engine) ToSQL(sql string) core.SQL
- 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(query interface{}, args ...interface{}) *Session
- type IterFunc
- type 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
- type ResultSet
- func (r *ResultSet) Get(index int) interface{}
- func (r *ResultSet) GetBool(index int) bool
- func (r *ResultSet) GetBoolByName(name string) bool
- func (r *ResultSet) GetByName(name string) interface{}
- func (r *ResultSet) GetFloat32(index int) float32
- func (r *ResultSet) GetFloat32ByName(name string) float32
- func (r *ResultSet) GetFloat64(index int) float64
- func (r *ResultSet) GetFloat64ByName(name string) float64
- func (r *ResultSet) GetInt(index int) int
- func (r *ResultSet) GetInt64(index int) int64
- func (r *ResultSet) GetInt64ByName(name string) int64
- func (r *ResultSet) GetIntByName(name string) int
- func (r *ResultSet) GetString(index int) string
- func (r *ResultSet) GetStringByName(name string) string
- func (r *ResultSet) GetTime(index int) time.Time
- func (r *ResultSet) GetTimeByName(name string) time.Time
- func (r *ResultSet) Set(index int, value interface{}) bool
- func (r *ResultSet) SetByName(name string, value interface{}) bool
- type Rows
- type SelectRows
- type Session
- func (session *Session) After(closures func(interface{})) *Session
- func (session *Session) Alias(alias string) *Session
- func (session *Session) AllCols() *Session
- func (session *Session) And(query interface{}, 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) Clone() *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) ForUpdate() *Session
- 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) 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(joinOperator 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) NoAutoCondition(no ...bool) *Session
- func (session *Session) NoAutoTime() *Session
- func (session *Session) NoCache() *Session
- func (session *Session) NoCascade() *Session
- func (session *Session) NotIn(column string, args ...interface{}) *Session
- func (session *Session) Nullable(columns ...string) *Session
- func (session *Session) Omit(columns ...string) *Session
- func (session *Session) Or(query interface{}, args ...interface{}) *Session
- func (session *Session) OrderBy(order string) *Session
- func (session *Session) Ping() error
- func (session *Session) Prepare() *Session
- func (session *Session) Q(sqlStr string, params ...interface{}) (resultsSlice []*ResultSet, err error)
- func (session *Session) QCallback(callback func(*core.Rows, []string), sqlStr string, params ...interface{}) (err error)
- func (session *Session) Query(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error)
- func (session *Session) QueryRaw(sqlStr string, params ...interface{}) ([]map[string]interface{}, error)
- func (session *Session) QueryStr(sqlStr string, params ...interface{}) ([]map[string]string, error)
- func (session *Session) Rollback() error
- func (session *Session) Rows(bean interface{}) (*Rows, error)
- func (session *Session) SQL(query interface{}, args ...interface{}) *Session
- func (session *Session) Select(str string) *Session
- func (session *Session) SetExpr(column string, expression string) *Session
- func (session *Session) Sql(query string, args ...interface{}) *Session
- func (session *Session) StoreEngine(storeEngine string) *Session
- func (session *Session) Sum(bean interface{}, columnName string) (float64, error)
- func (session *Session) Sums(bean interface{}, columnNames ...string) ([]float64, error)
- func (session *Session) SumsInt(bean interface{}, columnNames ...string) ([]int64, error)
- func (session *Session) Sync2(beans ...interface{}) error
- 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(query interface{}, args ...interface{}) *Session
- type SimpleLogger
- func (s *SimpleLogger) Debug(v ...interface{})
- func (s *SimpleLogger) Debugf(format string, v ...interface{})
- func (s *SimpleLogger) Error(v ...interface{})
- func (s *SimpleLogger) Errorf(format string, v ...interface{})
- func (s *SimpleLogger) Info(v ...interface{})
- func (s *SimpleLogger) Infof(format string, v ...interface{})
- func (s *SimpleLogger) IsShowSQL() bool
- func (s *SimpleLogger) Level() core.LogLevel
- func (s *SimpleLogger) SetLevel(l core.LogLevel)
- func (s *SimpleLogger) ShowSQL(show ...bool)
- func (s *SimpleLogger) Warn(v ...interface{})
- func (s *SimpleLogger) Warnf(format string, v ...interface{})
- type Statement
- func (statement *Statement) Alias(alias string) *Statement
- func (statement *Statement) AllCols() *Statement
- func (statement *Statement) And(query interface{}, 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) ForUpdate() *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(joinOP string, tablename interface{}, condition string, args ...interface{}) *Statement
- func (statement *Statement) JoinColumns(cols []*core.Column, includeTableName bool) string
- func (statement *Statement) JoinStr() string
- func (statement *Statement) Limit(limit int, start ...int) *Statement
- func (statement *Statement) MustCols(columns ...string) *Statement
- func (statement *Statement) NoAutoCondition(no ...bool) *Statement
- func (statement *Statement) NotIn(column string, args ...interface{}) *Statement
- func (statement *Statement) Nullable(columns ...string)
- func (statement *Statement) Omit(columns ...string)
- func (statement *Statement) Or(query interface{}, args ...interface{}) *Statement
- func (statement *Statement) OrderBy(order string) *Statement
- func (statement *Statement) SQL(query interface{}, args ...interface{}) *Statement
- func (s *Statement) Select(str string) *Statement
- func (statement *Statement) SetExpr(column string, expression string) *Statement
- func (statement *Statement) SetRelation(r *core.Relation)
- 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(query interface{}, args ...interface{}) *Statement
- type SyslogLogger
- func (s *SyslogLogger) Debug(v ...interface{})
- func (s *SyslogLogger) Debugf(format string, v ...interface{})
- func (s *SyslogLogger) Error(v ...interface{})
- func (s *SyslogLogger) Errorf(format string, v ...interface{})
- func (s *SyslogLogger) Info(v ...interface{})
- func (s *SyslogLogger) Infof(format string, v ...interface{})
- func (s *SyslogLogger) IsShowSQL() bool
- func (s *SyslogLogger) Level() core.LogLevel
- func (s *SyslogLogger) SetLevel(l core.LogLevel)
- func (s *SyslogLogger) ShowSQL(show ...bool)
- func (s *SyslogLogger) Warn(v ...interface{})
- func (s *SyslogLogger) Warnf(format string, v ...interface{})
- type TABLE_NAME
- type TLogger
- func (t *TLogger) Close(tags ...string)
- func (t *TLogger) Min() time.Duration
- func (t *TLogger) Open(tags ...string)
- func (t *TLogger) SetLogger(logger core.ILogger)
- func (t *TLogger) SetMin(min time.Duration) *TLogger
- func (t *TLogger) SetProcessor(...)
- func (t *TLogger) SetStatusByName(tag string, status bool)
- type Table
- type TableName
Constants ¶
const ( DEFAULT_LOG_PREFIX = "[xorm]" DEFAULT_LOG_FLAG = log.Ldate | log.Lmicroseconds DEFAULT_LOG_LEVEL = core.LOG_DEBUG )
const ( // Version show the xorm's version Version string = "0.6.0.0923" )
Variables ¶
var ( ErrParamsType error = errors.New("Params type error") ErrTableNotFound error = errors.New("Not found table") ErrUnSupportedType error = errors.New("Unsupported type error") ErrNotExist error = errors.New("Not exist error") ErrCacheFailed error = errors.New("Cache failed") ErrNeedDeletedCond error = errors.New("Delete need at least one condition") ErrNotImplemented error = errors.New("Not implemented.") )
Functions ¶
func AddCSlashes ¶
func AddSlashes ¶
func NewJoinParam ¶
func NewJoinParam(stmt *Statement) *joinParam
Types ¶
type AdmpubLogger ¶
AdmpubLogger is the default implment of core.ILogger
func NewAdmpubLogger ¶
func NewAdmpubLogger(args ...*log.Logger) *AdmpubLogger
func NewAdmpubLoggerWithPrefix ¶
func NewAdmpubLoggerWithPrefix(prefix string, args ...*log.Logger) *AdmpubLogger
func (*AdmpubLogger) IsShowSQL ¶
func (s *AdmpubLogger) IsShowSQL() bool
IsShowSQL implement core.ILogger
func (*AdmpubLogger) Level ¶
func (s *AdmpubLogger) Level() core.LogLevel
Level implement core.ILogger
func (*AdmpubLogger) SetLevel ¶
func (s *AdmpubLogger) SetLevel(l core.LogLevel)
SetLevel implement core.ILogger
func (*AdmpubLogger) ShowSQL ¶
func (s *AdmpubLogger) ShowSQL(show ...bool)
ShowSQL implement core.ILogger
type AfterDeleteProcessor ¶
type AfterDeleteProcessor interface {
AfterDelete()
}
Executed after an object has been deleted
type AfterInsertProcessor ¶
type AfterInsertProcessor interface {
AfterInsert()
}
Executed after an object is persisted to the database
type AfterSetProcessor ¶
type AfterUpdateProcessor ¶
type AfterUpdateProcessor interface {
AfterUpdate()
}
Executed after an object has been updated
type BeforeDeleteProcessor ¶
type BeforeDeleteProcessor interface {
BeforeDelete()
}
Executed before an object is deleted
type BeforeInsertProcessor ¶
type BeforeInsertProcessor interface {
BeforeInsert()
}
Executed before an object is initially persisted to the database
type BeforeSetProcessor ¶
type BeforeUpdateProcessor ¶
type BeforeUpdateProcessor interface {
BeforeUpdate()
}
Executed before an object is updated
type CLogger ¶
type DiscardLogger ¶
type DiscardLogger struct{}
func (DiscardLogger) Debug ¶
func (DiscardLogger) Debug(v ...interface{})
func (DiscardLogger) Debugf ¶
func (DiscardLogger) Debugf(format string, v ...interface{})
func (DiscardLogger) Error ¶
func (DiscardLogger) Error(v ...interface{})
func (DiscardLogger) Errorf ¶
func (DiscardLogger) Errorf(format string, v ...interface{})
func (DiscardLogger) Info ¶
func (DiscardLogger) Info(v ...interface{})
func (DiscardLogger) Infof ¶
func (DiscardLogger) Infof(format string, v ...interface{})
func (DiscardLogger) IsShowSQL ¶
func (DiscardLogger) IsShowSQL() bool
func (DiscardLogger) Level ¶
func (DiscardLogger) Level() core.LogLevel
func (DiscardLogger) SetLevel ¶
func (DiscardLogger) SetLevel(l core.LogLevel)
func (DiscardLogger) ShowSQL ¶
func (DiscardLogger) ShowSQL(show ...bool)
func (DiscardLogger) Warn ¶
func (DiscardLogger) Warn(v ...interface{})
func (DiscardLogger) Warnf ¶
func (DiscardLogger) Warnf(format string, v ...interface{})
type Engine ¶
type Engine struct { ColumnMapper core.IMapper TableMapper core.IMapper TagIdentifier string Tables map[reflect.Type]*core.Table Cacher core.Cacher TZLocation *time.Location DatabaseTZ *time.Location // The timezone of the database //[SWH|+] TablePrefix string TableSuffix string RelTagIdentifier string AliasTagIdentifier string TLogger *TLogger // contains filtered or unexported fields }
Engine is the major struct of xorm, it means a database manager. Commonly, an application only need one engine
func NewEngine ¶
NewEngine new a db manager according to the parameter. Currently support four drivers
func (*Engine) Asc ¶
Asc will generate "ORDER BY column1,column2 Asc" This method can chainable use.
engine.Desc("name").Asc("age").Find(&users) // SELECT * FROM user ORDER BY name DESC, age ASC
func (*Engine) AutoIncrStr ¶
AutoIncrStr Database's autoincrement statement
func (*Engine) ClearCache ¶
ClearCache if enabled cache, clear some tables' cache
func (*Engine) ClearCacheBean ¶
ClearCacheBean if enabled cache, clear the cache bean
func (*Engine) CreateIndexes ¶
CreateIndexes create indexes
func (*Engine) CreateTables ¶
CreateTables create tabls according bean
func (*Engine) CreateUniques ¶
CreateUniques create uniques
func (*Engine) DataSourceName ¶
DataSourceName return the current connection string
func (*Engine) Distinct ¶
Distinct use for distinct columns. Caution: when you are using cache, distinct will not be cached because cache system need id, but distinct will not provide id
func (*Engine) DriverName ¶
DriverName return the current sql driver's name
func (*Engine) DropIndexes ¶
DropIndexes drop indexes
func (*Engine) DropTables ¶
DropTables drop specify tables
func (*Engine) DumpAllToFile ¶
DumpAllToFile dump database all table structs and data to a file
func (*Engine) DumpTables ¶
DumpTables dump specify tables to io.Writer
func (*Engine) DumpTablesToFile ¶
DumpTablesToFile dump specified tables to SQL file.
func (*Engine) Find ¶
Find retrieve records from table, condiBeans's non-empty fields are conditions. beans could be []Struct, []*Struct, map[int64]Struct map[int64]*Struct
func (*Engine) FormatTime ¶
FormatTime format time
func (*Engine) GobRegister ¶
GobRegister register one struct to gob for cache use
func (*Engine) ImportFile ¶
ImportFile SQL DDL file
func (*Engine) InsertMulti ¶
InsertMulti Insert more records
func (*Engine) IsTableEmpty ¶
IsTableEmpty if a table has any reocrd
func (*Engine) IsTableExist ¶
IsTableExist if a table is exist
func (*Engine) Iterate ¶
Iterate record by record handle records from table, bean's non-empty fields are conditions.
func (*Engine) Join ¶
func (engine *Engine) Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *Session
Join the join_operator should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN
func (*Engine) NoAutoCondition ¶
NoAutoCondition disable auto generate Where condition from bean or not
func (*Engine) NoAutoTime ¶
NoAutoTime Default if your struct has "created" or "updated" filed tag, the fields will automatically be filled with current time when Insert or Update invoked. Call NoAutoTime if you dont' want to fill automatically.
func (*Engine) NoCache ¶
NoCache If you has set default cacher, and you want temporilly stop use cache, you can use NoCache()
func (*Engine) Query ¶
func (engine *Engine) Query(sql string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error)
Query a raw sql and return records as []map[string][]byte
func (*Engine) QuoteStr ¶
QuoteStr Engine's database use which charactor as quote. mysql, sqlite use ` and postgres use "
func (*Engine) QuoteValue ¶
func (*Engine) QuoteWithDelim ¶
func (*Engine) RawBatchInsert ¶
func (*Engine) RawFetchAll ¶
func (this *Engine) RawFetchAll(fields string, table string, where string, params ...interface{}) []map[string]string
----------------------- map结果 -----------------------
func (*Engine) RawOnlyInsert ¶
func (*Engine) RawQuery ¶
func (this *Engine) RawQuery(sql string, params ...interface{}) (resultsSlice []*ResultSet, err error)
======================= 原生SQL查询 =======================
func (*Engine) RawQueryAllKvs ¶
func (*Engine) RawQueryCallback ¶
func (*Engine) RawQueryKv ¶
func (this *Engine) RawQueryKv(key string, val string, sql string, params ...interface{}) map[string]string
*
- 查询键值对
func (*Engine) RawQueryKvs ¶
func (this *Engine) RawQueryKvs(key string, sql string, params ...interface{}) map[string]map[string]string
*
- 查询基于指定字段值为键名的map
func (*Engine) RawReplace ¶
func (*Engine) RawSelect ¶
func (this *Engine) RawSelect(fields string, table string, where string, params ...interface{}) SelectRows
RawSelect("*","member","id=?",1) RawSelect("*","member","status=? AND sex=?",1,1) RawSelect("*","`~member` a,`~order` b","a.status=? AND b.status=?",1,1)
func (*Engine) ReplaceTablePrefix ¶
func (*Engine) Rows ¶
Rows return sql.Rows compatible Rows obj, as a forward Iterator object for iterating record by record, bean's non-empty fields are conditions.
func (*Engine) SQL ¶
SQL method let's you manualy write raw SQL and operate For example:
engine.SQL("select * from user").Find(&users)
This code will execute "select * from user" and set the records to users
func (*Engine) SetColumnMapper ¶
SetColumnMapper set the column name mapping rule
func (*Engine) SetDefaultCacher ¶
SetDefaultCacher set the default cacher. Xorm's default not enable cacher.
func (*Engine) SetDisableGlobalCache ¶
SetDisableGlobalCache disable global cache or not
func (*Engine) SetMaxIdleConns ¶
SetMaxIdleConns set the max idle connections on pool, default is 2
func (*Engine) SetMaxOpenConns ¶
SetMaxOpenConns is only available for go 1.2+
func (*Engine) SetTableMapper ¶
SetTableMapper set the table name mapping rule
func (*Engine) SetTblMapper ¶
func (*Engine) ShowExecTime ¶
ShowExecTime show SQL statment and execute time or not on logger if log level is great than INFO
func (*Engine) StoreEngine ¶
StoreEngine set store engine when create table, only support mysql now
func (*Engine) SupportInsertMany ¶
SupportInsertMany If engine's database support batch insert records like "insert into user values (name, age), (name, age)". When the return is ture, then engine.Insert(&users) will generate batch sql and exeute.
func (*Engine) Sync ¶
Sync the new struct changes to database, this method will automatically add table, column, index, unique. but will not delete or change anything. If you change some field, you should change the database manually.
func (*Engine) Update ¶
Update records, bean's non-empty fields are updated contents, condiBean' non-empty filds are conditions CAUTION:
1.bool will defaultly be updated content nor conditions You should call UseBool if you have bool to use. 2.float32 & float64 may be not inexact as conditions
type LRUCacher ¶
type LRUCacher struct { // maxSize int MaxElementSize int Expired time.Duration GcInterval time.Duration // contains filtered or unexported fields }
func NewLRUCacher ¶
func NewLRUCacher(store core.CacheStore, maxElementSize int) *LRUCacher
func NewLRUCacher2 ¶
func (*LRUCacher) ClearBeans ¶
func (*LRUCacher) GC ¶
func (m *LRUCacher) GC()
GC check ids lit and sql list to remove all element expired
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
memory store
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func (*MemoryStore) Del ¶
func (s *MemoryStore) Del(key string) error
func (*MemoryStore) Get ¶
func (s *MemoryStore) Get(key string) (interface{}, error)
func (*MemoryStore) Put ¶
func (s *MemoryStore) Put(key string, value interface{}) error
type ResultSet ¶
type ResultSet struct { Fields []string Values []*reflect.Value NameIndex map[string]int Length int }
func NewResultSet ¶
func NewResultSet() *ResultSet
===================================== 定义ResultSet =====================================
func (*ResultSet) GetBoolByName ¶
func (*ResultSet) GetFloat32 ¶
func (*ResultSet) GetFloat32ByName ¶
func (*ResultSet) GetFloat64 ¶
func (*ResultSet) GetFloat64ByName ¶
func (*ResultSet) GetInt64ByName ¶
func (*ResultSet) GetIntByName ¶
func (*ResultSet) GetStringByName ¶
type Rows ¶
type Rows struct { NoTypeCheck bool // contains filtered or unexported fields }
Rows rows wrapper a rows to
func (*Rows) Err ¶
Err returns the error, if any, that was encountered during iteration. Err may be called after an explicit or implicit Close.
type SelectRows ¶
type SelectRows []*ResultSet
func (SelectRows) GetOne ¶
func (this SelectRows) GetOne() (result string)
func (SelectRows) GetRow ¶
func (this SelectRows) GetRow() (result *ResultSet)
type Session ¶
type Session struct { Engine *Engine Tx *core.Tx Statement Statement IsAutoCommit bool IsCommitedOrRollbacked bool TransType string IsAutoClose bool // Automatically reset the statement after operations that execute a SQL // query such as Count(), Find(), Get(), ... AutoResetStatement bool // contains filtered or unexported fields }
Session keep a pointer to sql.DB and provides all execution of all kind of database operations.
func (*Session) CreateIndexes ¶
CreateIndexes create indexes
func (*Session) CreateTable ¶
CreateTable create a table according a bean
func (*Session) CreateUniques ¶
CreateUniques create uniques
func (*Session) Desc ¶
Desc provide desc order by query condition, the input parameters are columns.
func (*Session) Distinct ¶
Distinct use for distinct columns. Caution: when you are using cache, distinct will not be cached because cache system need id, but distinct will not provide id
func (*Session) DropIndexes ¶
DropIndexes drop indexes
func (*Session) DropTable ¶
DropTable drop table will drop table if exist, if drop failed, it will return error
func (*Session) Find ¶
Find retrieve records from table, condiBeans's non-empty fields are conditions. beans could be []Struct, []*Struct, map[int64]Struct map[int64]*Struct
func (*Session) Get ¶
Get retrieve one record from database, bean's non-empty fields will be as conditions
func (*Session) InsertMulti ¶
InsertMulti insert multiple records
func (*Session) InsertOne ¶
InsertOne insert only one struct into database as a record. The in parameter bean must a struct or a point to struct. The return parameter is inserted and error
func (*Session) IsTableEmpty ¶
IsTableEmpty if table have any records
func (*Session) IsTableExist ¶
IsTableExist if a table is exist
func (*Session) Iterate ¶
Iterate record by record handle records from table, condiBeans's non-empty fields are conditions. beans could be []Struct, []*Struct, map[int64]Struct map[int64]*Struct
func (*Session) Join ¶
func (session *Session) Join(joinOperator string, tablename interface{}, condition string, args ...interface{}) *Session
Join join_operator should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN
func (*Session) NoAutoCondition ¶
NoAutoCondition disable generate SQL condition from beans
func (*Session) NoAutoTime ¶
NoAutoTime means do not automatically give created field and updated field the current time on the current session temporarily
func (*Session) NoCache ¶
NoCache ask this session do not retrieve data from cache system and get data from database directly.
func (*Session) OrderBy ¶
OrderBy provide order by query condition, the input parameter is the content after order by on a sql statement.
func (*Session) Prepare ¶
Prepare set a flag to session that should be prepare statment before execute query
func (*Session) Q ¶
func (session *Session) Q(sqlStr string, params ...interface{}) (resultsSlice []*ResultSet, err error)
*
- Exec a raw sql and return records as []*ResultSet
- @param string SQL
- @param ...interface{} params
- @return []*ResultSet,error
- @author AdamShen (swh@admpub.com)
func (*Session) QCallback ¶
func (session *Session) QCallback(callback func(*core.Rows, []string), sqlStr string, params ...interface{}) (err error)
*
- 逐行执行回调函数
- @param func(*core.Rows) callback callback func
- @param string sqlStr SQL
- @param ...interface{} params params
- @return error
- @author AdamShen (swh@admpub.com)
- @example
- QCallback(func(rows *core.Rows){
- if err := rows.Scan(bean); err != nil {
- return
- }
- //.....
- },"SELECT * FROM shop WHERE type=?","vip")
func (*Session) Query ¶
func (session *Session) Query(sqlStr string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error)
Query a raw sql and return records as []map[string][]byte
func (*Session) QueryStr ¶
===================================== 增加Session结构体中的方法 =====================================
func (*Session) Rows ¶
Rows return sql.Rows compatible Rows obj, as a forward Iterator object for iterating record by record, bean's non-empty fields are conditions.
func (*Session) SQL ¶
SQL provides raw sql input parameter. When you have a complex SQL statement and cannot use Where, Id, In and etc. Methods to describe, you can use SQL.
func (*Session) StoreEngine ¶
StoreEngine is only avialble mysql dialect currently
func (*Session) Table ¶
Table can input a string or pointer to struct for special a table to operate.
func (*Session) Update ¶
Update records, bean's non-empty fields are updated contents, condiBean' non-empty filds are conditions CAUTION:
1.bool will defaultly be updated content nor conditions You should call UseBool if you have bool to use. 2.float32 & float64 may be not inexact as conditions
type SimpleLogger ¶
type SimpleLogger struct { DEBUG *log.Logger ERR *log.Logger INFO *log.Logger WARN *log.Logger // contains filtered or unexported fields }
SimpleLogger is the default implment of core.ILogger
func NewSimpleLogger ¶
func NewSimpleLogger(out io.Writer) *SimpleLogger
NewSimpleLogger use a special io.Writer as logger output
func NewSimpleLogger2 ¶
func NewSimpleLogger2(out io.Writer, prefix string, flag int) *SimpleLogger
NewSimpleLogger2 let you customrize your logger prefix and flag
func NewSimpleLogger3 ¶
NewSimpleLogger3 let you customrize your logger prefix and flag and logLevel
func (*SimpleLogger) Debug ¶
func (s *SimpleLogger) Debug(v ...interface{})
Debug implement core.ILogger
func (*SimpleLogger) Debugf ¶
func (s *SimpleLogger) Debugf(format string, v ...interface{})
Debugf implement core.ILogger
func (*SimpleLogger) Error ¶
func (s *SimpleLogger) Error(v ...interface{})
Error implement core.ILogger
func (*SimpleLogger) Errorf ¶
func (s *SimpleLogger) Errorf(format string, v ...interface{})
Errorf implement core.ILogger
func (*SimpleLogger) Info ¶
func (s *SimpleLogger) Info(v ...interface{})
Info implement core.ILogger
func (*SimpleLogger) Infof ¶
func (s *SimpleLogger) Infof(format string, v ...interface{})
Infof implement core.ILogger
func (*SimpleLogger) IsShowSQL ¶
func (s *SimpleLogger) IsShowSQL() bool
IsShowSQL implement core.ILogger
func (*SimpleLogger) Level ¶
func (s *SimpleLogger) Level() core.LogLevel
Level implement core.ILogger
func (*SimpleLogger) SetLevel ¶
func (s *SimpleLogger) SetLevel(l core.LogLevel)
SetLevel implement core.ILogger
func (*SimpleLogger) ShowSQL ¶
func (s *SimpleLogger) ShowSQL(show ...bool)
ShowSQL implement core.ILogger
func (*SimpleLogger) Warn ¶
func (s *SimpleLogger) Warn(v ...interface{})
Warn implement core.ILogger
func (*SimpleLogger) Warnf ¶
func (s *SimpleLogger) Warnf(format string, v ...interface{})
Warnf implement core.ILogger
type Statement ¶
type Statement struct { RefTable *core.Table Engine *Engine Start int LimitN int IdParam *core.PK OrderStr string GroupByStr string HavingStr string ColumnStr string OmitStr string AltTableName string RawSQL string RawParams []interface{} UseCascade bool UseAutoJoin bool StoreEngine string Charset string UseCache bool UseAutoTime bool IsDistinct bool IsForUpdate bool TableAlias string // contains filtered or unexported fields }
Statement save all the sql info for executing SQL
func (*Statement) Id ¶
Id generate "where id = ? " statment or for composite key "where key1 = ? and key2 = ?"
func (*Statement) Join ¶
func (statement *Statement) Join(joinOP string, tablename interface{}, condition string, args ...interface{}) *Statement
Join The joinOP should be one of INNER, LEFT OUTER, CROSS etc - this will be prepended to JOIN
func (*Statement) JoinColumns ¶
func (*Statement) NoAutoCondition ¶
NoAutoCondition if you do not want convert bean's field as query condition, then use this function
func (*Statement) Nullable ¶
Nullable Update use only: update columns to null when value is nullable and zero-value
func (*Statement) SetRelation ¶
func (*Statement) Table ¶
Table tempororily set table name, the parameter could be a string or a pointer of struct
type SyslogLogger ¶
type SyslogLogger struct {
// contains filtered or unexported fields
}
SyslogLogger will be depricated
func NewSyslogLogger ¶
func NewSyslogLogger(w *syslog.Writer) *SyslogLogger
func (*SyslogLogger) Debug ¶
func (s *SyslogLogger) Debug(v ...interface{})
func (*SyslogLogger) Debugf ¶
func (s *SyslogLogger) Debugf(format string, v ...interface{})
func (*SyslogLogger) Error ¶
func (s *SyslogLogger) Error(v ...interface{})
func (*SyslogLogger) Errorf ¶
func (s *SyslogLogger) Errorf(format string, v ...interface{})
func (*SyslogLogger) Info ¶
func (s *SyslogLogger) Info(v ...interface{})
func (*SyslogLogger) Infof ¶
func (s *SyslogLogger) Infof(format string, v ...interface{})
func (*SyslogLogger) IsShowSQL ¶
func (s *SyslogLogger) IsShowSQL() bool
func (*SyslogLogger) Level ¶
func (s *SyslogLogger) Level() core.LogLevel
func (*SyslogLogger) SetLevel ¶
func (s *SyslogLogger) SetLevel(l core.LogLevel)
SetLevel always return error, as current log/syslog package doesn't allow to set priority level after syslog.Writer created
func (*SyslogLogger) ShowSQL ¶
func (s *SyslogLogger) ShowSQL(show ...bool)
func (*SyslogLogger) Warn ¶
func (s *SyslogLogger) Warn(v ...interface{})
func (*SyslogLogger) Warnf ¶
func (s *SyslogLogger) Warnf(format string, v ...interface{})
type TABLE_NAME ¶
type TABLE_NAME interface {
TABLE_NAME() string
}
type TLogger ¶
type TLogger struct { SQL *CLogger Event *CLogger Cache *CLogger ETime *CLogger Base *CLogger Other *CLogger // contains filtered or unexported fields }
func NewTLogger ¶
func (*TLogger) SetProcessor ¶
func (*TLogger) SetStatusByName ¶
Source Files ¶
- coscms.go
- dialect_mssql.go
- dialect_mysql.go
- dialect_oracle.go
- dialect_postgres.go
- dialect_sqlite3.go
- doc.go
- engine.go
- engine_ex.go
- error.go
- helpers.go
- logger.go
- logger_ex.go
- logger_tag.go
- lru_cacher.go
- memory_store.go
- processors.go
- rows.go
- session.go
- session_backfill.go
- session_convert.go
- session_count.go
- session_delete.go
- session_insert.go
- session_raw.go
- session_rows.go
- session_schema.go
- session_select.go
- session_settings.go
- session_tx.go
- session_update.go
- statement.go
- statement_ex.go
- syslogger.go
- types.go
- xorm.go
Directories ¶
Path | Synopsis |
---|---|
Package builder is a simple and powerful sql builder for Go.
|
Package builder is a simple and powerful sql builder for Go. |
cmd
|
|
[SWH|+] 关联关系
|
[SWH|+] 关联关系 |
driver
|
|
godbc
Package odbc implements database/sql driver to access data via odbc interface.
|
Package odbc implements database/sql driver to access data via odbc interface. |