Documentation ¶
Index ¶
- Constants
- func GetColumns(m ITableName) []string
- func GetPrimarykey(engine *xorm.Engine, m interface{}) *schemas.Column
- func JoinQuery(engine *xorm.Engine, native, foreign ITableName, fkey, pkey, joinOp string) *xorm.Session
- func LeftJoinQuery(engine *xorm.Engine, native, foreign ITableName, fkey string) *xorm.Session
- func MoveEdge(query *xorm.Session, base uint, offset string) error
- func NegativeOffset(offset, pagesize, total int) int
- func Paginate(query *xorm.Session, pageno, pagesize int) *xorm.Session
- func Qprintf(engine *xorm.Engine, format string, args ...interface{}) string
- func SessListJoin(data []string) string
- func SessListSplit(data string) []string
- type FilterFunc
- type ITableComment
- type ITableName
- type ModifyFunc
- type NestedMixin
- type Session
- type SessionRegistry
- type TimeMixin
Constants ¶
View Source
const ( MAX_TIMEOUT = 86400 * 30 // 接近无限时间 SESS_ONLINE_KEY = "onlines" // 在线用户 SESS_TOKEN_KEY = "_token_" SESS_PREFIX = "sess" // 会话缓存前缀 SESS_TIMEOUT = 7200 // 会话缓存时间 SESS_LIST_SEP = ";" // 角色名之间的分隔符 )
Variables ¶
This section is empty.
Functions ¶
func GetPrimarykey ¶ added in v0.9.1
获取Model的字段列表
func JoinQuery ¶ added in v0.9.1
func JoinQuery(engine *xorm.Engine, native, foreign ITableName, fkey, pkey, joinOp string) *xorm.Session
联表查询
func LeftJoinQuery ¶ added in v0.9.1
Left Join 联表查询
func SessListJoin ¶
func SessListSplit ¶
Types ¶
type NestedMixin ¶ added in v0.3.3
type NestedMixin struct { Lft int `json:"lft" xorm:"notnull default 0 comment('左边界') INT(10)"` // 左边界 Rgt int `json:"rgt" xorm:"notnull default 0 comment('右边界') index INT(10)"` // 右边界 Depth int `json:"depth" xorm:"notnull default 1 comment('高度') index TINYINT(3)"` // 高度 }
嵌套集合树
func (*NestedMixin) AddToParent ¶ added in v0.3.3
func (n *NestedMixin) AddToParent(parent *NestedMixin, tbQuery *xorm.Session) error
添加到父节点最末,tbQuery一定要使用db.Table(...)
func (NestedMixin) AncestorsFilter ¶ added in v0.3.3
func (n NestedMixin) AncestorsFilter(backward bool) FilterFunc
找出所有直系祖先节点
func (NestedMixin) ChildrenFilter ¶ added in v0.3.3
func (n NestedMixin) ChildrenFilter(rank uint8) FilterFunc
找出所有子孙节点
func (NestedMixin) CountChildren ¶ added in v0.3.3
func (n NestedMixin) CountChildren() int
有多少个子孙节点
type Session ¶
func NewSession ¶
func NewSession(reg *SessionRegistry, key string) *Session
func (*Session) GetFlashes ¶
数量n为最大取出多少条消息,-1表示所有消息
type SessionRegistry ¶
type SessionRegistry struct { Onlines *redisw.RedisHash *redisw.RedisWrapper // contains filtered or unexported fields }
func InitCache ¶
func InitCache(c config.ConnConfig, verbose bool) (*SessionRegistry, error)
func NewRegistry ¶
func NewRegistry(w *redisw.RedisWrapper) *SessionRegistry
func (*SessionRegistry) DelSession ¶
func (sr *SessionRegistry) DelSession(token string) bool
func (SessionRegistry) GetKey ¶
func (sr SessionRegistry) GetKey(token string) string
func (*SessionRegistry) GetSession ¶
func (sr *SessionRegistry) GetSession(token string) *Session
type TimeMixin ¶ added in v0.3.3
type TimeMixin 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.