Documentation ¶
Index ¶
- func InitCache(cfg *config.Settings, name string, verbose bool) (*session.SessionRegistry, error)
- func InitConn(cfg *config.Settings, name string, verbose bool) (*xorm.Engine, error)
- func MoveEdge(query *xorm.Session, base uint, offset string) error
- func Paginate(query *xorm.Session, out interface{}, pageno, pagesize int) (int, error)
- type BaseModel
- type FilterFunc
- type ITableComment
- type ITableName
- type NestedModel
- type SqlTag
- type TimeModel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BaseModel ¶
type BaseModel struct {
Id uint `json:"id" xorm:"not null pk autoincr INT(10)"`
}
*
- 带自增主键的基础Model
func (BaseModel) TableComment ¶
type NestedModel ¶
type NestedModel struct { Lft int `json:"lft" xorm:"not null default 0 comment('左边界') INT(10)"` Rgt int `json:"rgt" xorm:"not null default 0 comment('右边界') index INT(10)"` Depth int `json:"depth" xorm:"not null default 1 comment('高度') index TINYINT(3)"` }
嵌套集合树
func (*NestedModel) AddToParent ¶
func (n *NestedModel) AddToParent(parent *NestedModel, tbQuery *xorm.Session) error
添加到父节点最末,tbQuery一定要使用db.Table(...)
func (NestedModel) AncestorsFilter ¶
func (n NestedModel) AncestorsFilter(Backward bool) FilterFunc
找出所有直系祖先节点
func (NestedModel) ChildrenFilter ¶
func (n NestedModel) ChildrenFilter(rank uint8) FilterFunc
找出所有子孙节点
type TimeModel ¶
type TimeModel struct { CreatedAt time.Time `json:"created_at" xorm:"created comment('创建时间') TIMESTAMP"` UpdatedAt time.Time `json:"updated_at" xorm:"updated comment('更新时间') TIMESTAMP"` DeletedAt time.Time `json:"deleted_at" xorm:"deleted comment('删除时间') index TIMESTAMP"` }
*
- 时间相关的三个典型字段
Click to show internal directories.
Click to hide internal directories.