Documentation ¶
Index ¶
- Variables
- func ConnDBStats(dbName string) sql.DBStats
- func Connector(dbName string) *xorm.Engine
- func CreateTable(tabs ...IEntity) error
- func DeleteTable(tabs ...IEntity) error
- func DropTable(tbls ...IEntity) error
- func ExistTable(tbl IEntity) (bool, error)
- func Install(confs []*Config) ctl.IControler
- func MTable(tbl IEntity) *table
- func SQLExec(tx *Session, query interface{}, args ...interface{}) (int64, error)
- func SQLExecute(dbName string, query interface{}, args ...interface{}) (int64, error)
- func SQLFind(dbName string, rowsSlicePtr interface{}, query interface{}, ...) error
- func SQLFindPage(dbName string, rowsSlicePtr interface{}, query interface{}, ...) (int64, error)
- func SQLGet(dbName string, beans []interface{}, query interface{}, args ...interface{}) (bool, error)
- func STable(tbl IEntity) *table
- func SynchTable(tbls ...IEntity) error
- func TTable(tx *Session, tbl IEntity) *table
- func Table(e EDB, tbl IEntity, tx ...*xorm.Session) *table
- type CondOpter
- type CondOpterFunc
- func COAndOr(e EAndOr, query string, args ...interface{}) CondOpterFunc
- func COCompare(field string, e ECompare, val interface{}) CondOpterFunc
- func COGroup(fields ...string) CondOpterFunc
- func COHaving(selAlias string, e ECompare, val interface{}) CondOpterFunc
- func COInNotIn(field string, e EContain, args ...interface{}) CondOpterFunc
- func COLike(field string, val string) CondOpterFunc
- func COLimit(num int) CondOpterFunc
- func COOrder(e ESort, fields ...string) CondOpterFunc
- func COPage(page, pnum int) CondOpterFunc
- func COWhere(query string, args ...interface{}) CondOpterFunc
- type Config
- type EAndOr
- type ECompare
- type EContain
- type EDB
- type ESort
- type IContrler
- type IEntity
- type IFieldData
- type Join
- type Session
- type XormLogger
- func (this *XormLogger) Debug(v ...interface{})
- func (this *XormLogger) Debugf(format string, v ...interface{})
- func (this *XormLogger) Error(v ...interface{})
- func (this *XormLogger) Errorf(format string, v ...interface{})
- func (this *XormLogger) Info(v ...interface{})
- func (this *XormLogger) Infof(format string, v ...interface{})
- func (this *XormLogger) IsShowSQL() bool
- func (this *XormLogger) Level() xlog.LogLevel
- func (this *XormLogger) SetLevel(l xlog.LogLevel)
- func (this *XormLogger) ShowSQL(show ...bool)
- func (this *XormLogger) Warn(v ...interface{})
- func (this *XormLogger) Warnf(format string, v ...interface{})
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func SQLExecute ¶
原生SQL执行(delete|update)[query:语句(支持?), args:语句参数]
func SQLFindPage ¶
func SQLFindPage(dbName string, rowsSlicePtr interface{}, query interface{}, args ...interface{}) (int64, error)
原生SQL执行(page)[rowsSlicePtr:输出slice或map, query:语句(支持?), args:语句参数]
Types ¶
type CondOpterFunc ¶
> 查询条件选项
func COAndOr ¶
func COAndOr(e EAndOr, query string, args ...interface{}) CondOpterFunc
查询选项[SQL]-自定义SQL条件(支持?)
func COCompare ¶
func COCompare(field string, e ECompare, val interface{}) CondOpterFunc
查询选项[ORM]-比较
func COHaving ¶
func COHaving(selAlias string, e ECompare, val interface{}) CondOpterFunc
查询选项[ORM]-过滤 (selAlias:select 中的聚合别名)
func COInNotIn ¶
func COInNotIn(field string, e EContain, args ...interface{}) CondOpterFunc
查询选项[ORM]-集合
func COWhere ¶
func COWhere(query string, args ...interface{}) CondOpterFunc
查询选项[SQL]-自定义SQL条件(支持?)
type Config ¶
type Config struct { Name string `json:"name"` Host string `json:"host"` Store string `json:"store"` User string `json:"user"` Passwd string `json:"passwd"` IdleMax int64 `json:"idle_max"` OpenMax int64 `json:"open_max"` ShowSql bool `json:"show_sql"` }
> DB配置
type IContrler ¶
type IContrler interface { ctl.IControler // 使用指定DB引擎 Use(name string) *xorm.Engine // 表存在不存在 Exist(name string, tbl IEntity) (bool, error) // 同步表结构 Sync(name string, tbls ...IEntity) error // 移除表 Drop(name string, tbls ...IEntity) error }
控制器接口
var Ctl IContrler // 默认DB控制器
func Controller ¶
func Controller() IContrler
type Join ¶
type Join struct { Type string // INNER(default)|LEFT JOIN|RIGHT JOIN Tablename interface{} // Tablename OnCond string // eg: on detail.user_id = user.id }
> join
type XormLogger ¶
==================== XormLogger
func (*XormLogger) Debug ¶
func (this *XormLogger) Debug(v ...interface{})
func (*XormLogger) Debugf ¶
func (this *XormLogger) Debugf(format string, v ...interface{})
func (*XormLogger) Error ¶
func (this *XormLogger) Error(v ...interface{})
func (*XormLogger) Errorf ¶
func (this *XormLogger) Errorf(format string, v ...interface{})
func (*XormLogger) Info ¶
func (this *XormLogger) Info(v ...interface{})
func (*XormLogger) Infof ¶
func (this *XormLogger) Infof(format string, v ...interface{})
func (*XormLogger) IsShowSQL ¶
func (this *XormLogger) IsShowSQL() bool
func (*XormLogger) Level ¶
func (this *XormLogger) Level() xlog.LogLevel
func (*XormLogger) SetLevel ¶
func (this *XormLogger) SetLevel(l xlog.LogLevel)
func (*XormLogger) ShowSQL ¶
func (this *XormLogger) ShowSQL(show ...bool)
func (*XormLogger) Warn ¶
func (this *XormLogger) Warn(v ...interface{})
func (*XormLogger) Warnf ¶
func (this *XormLogger) Warnf(format string, v ...interface{})
Click to show internal directories.
Click to hide internal directories.