Documentation
¶
Overview ¶
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS. Package xsession: 提供了数据模型(Orm)、内存沙箱(Cache > Redis > DB)、日志输出(GLog...)等功能.
Copyright (C) Wells Hsu, wellshsu@github.com, All rights reserved. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This license is based on GPL, SEE LICENSE.md FOR MORE DETAILS.
Index ¶
- Constants
- func GClear(model xorm.ITable, _cond ...*xorm.Condition)
- func GCount(model xorm.ITable, _cond ...*xorm.Condition) int
- func GDelete(model xorm.ITable)
- func GDump(reset bool) string
- func GFinish(id int64)
- func GID() int
- func GIncrease(model xorm.ITable, columnAndDelta ...interface{}) int
- func GList(model xorm.ITable, _cond ...*xorm.Condition) interface{}
- func GLogAlert(f interface{}, v ...interface{})
- func GLogCritical(f interface{}, v ...interface{})
- func GLogDebug(f interface{}, v ...interface{})
- func GLogEmergency(f interface{}, v ...interface{})
- func GLogError(f interface{}, v ...interface{})
- func GLogInfo(f interface{}, v ...interface{})
- func GLogNotice(f interface{}, v ...interface{})
- func GLogWarn(f interface{}, v ...interface{})
- func GMaxIndex(model xorm.ITable, column ...string) int
- func GMinIndex(model xorm.ITable, column ...string) int
- func GRead(model xorm.ITable, _cond ...*xorm.Condition) xorm.ITable
- func GStart(tag interface{}, log int, rw bool) int64
- func GWrite(model xorm.ITable)
- func MGMax(model xorm.ITable) *sync.Map
- func MGMem(prefix string, model xorm.ITable) *sync.Map
- func MPCount() int64
- func MPipe() chan *PipeRecord
- func MSMem(prefix string, model xorm.ITable) *sync.Map
- type DeferFun
- type DeleteRecord
- type GlobalObject
- type PipeObject
- type PipeRecord
- type ProfilerRecord
- func (this *ProfilerRecord) GLogAlert(f interface{}, v ...interface{})
- func (this *ProfilerRecord) GLogCritical(f interface{}, v ...interface{})
- func (this *ProfilerRecord) GLogDebug(f interface{}, v ...interface{})
- func (this *ProfilerRecord) GLogEmergency(f interface{}, v ...interface{})
- func (this *ProfilerRecord) GLogError(f interface{}, v ...interface{})
- func (this *ProfilerRecord) GLogInfo(f interface{}, v ...interface{})
- func (this *ProfilerRecord) GLogNotice(f interface{}, v ...interface{})
- func (this *ProfilerRecord) GLogWarn(f interface{}, v ...interface{})
- func (this *ProfilerRecord) LogPrefix() string
- func (this *ProfilerRecord) Reset()
- type SessionObject
Constants ¶
const (
PIPE_CHAN_MAX = 100000 // 推送队列最大长度
)
Variables ¶
This section is empty.
Functions ¶
func GCount ¶ added in v1.2.2
数据数量
priority: 会话内存 > 全局缓存(LCache == true) > Redis(LRedis == true) > DB(LDB == true) notice: 远端列举(LCache == false、该会话首次列举、条件查找),会触发数据同步锁,可能会严重影响效率(等待GDelete操作完成),可预加载(GList)该模型优化之 model: 数据模型 _cond: 条件对象
func GIncrease ¶
获取DB指定Column(列)的最大值,并且自增(指定delta值或+1),若未指定Column则自增主键
model: 数据模型 columnAndDelta(1): column/delta(column需为int类型) columnAndDelta(2): column&delta(column需为int类型)
func GList ¶
列举数据
priority: 会话内存 > 全局缓存(LCache == true) > Redis(LRedis == true) > DB(LDB == true) notice: 远端列举(LCache == false、该会话首次列举、条件查找),会触发数据同步锁,可能会严重影响效率(等待GDelete操作完成),可预加载(GList)该模型优化之 model: 数据模型 _cond: 条件对象
func GLogAlert ¶
func GLogAlert(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func GLogCritical ¶
func GLogCritical(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func GLogDebug ¶
func GLogDebug(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func GLogEmergency ¶
func GLogEmergency(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func GLogError ¶
func GLogError(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func GLogInfo ¶
func GLogInfo(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func GLogNotice ¶
func GLogNotice(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func GLogWarn ¶
func GLogWarn(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func GMaxIndex ¶
获取DB指定Column(列)的最大值,若未指定Column则获取主键的最大值
notice: 异步写入可能会导致该值不同步 column: 列名(column需为int类型)
func GMinIndex ¶
获取DB指定Column(列)的最小值,若未指定Column则获取主键的最小值
notice: 异步写入可能会导致该值不同步 column: 列名(column需为int类型)
func GRead ¶
读取数据
priority: 会话内存 > 全局缓存(LCache == true) > Redis(LRedis == true) > DB(LDB == true) notice: 远端读取(LCache == false、该会话首次读取、条件查找),会触发数据同步锁,可能会严重影响效率(等待GDelete操作完成),可预加载(GList)该模型优化之 model: 数据模型 _cond: 条件对象
Types ¶
type GlobalObject ¶
全局对象维护
type PipeObject ¶
type PipeObject struct {
Raw xorm.ITable // 原始对象
SWrite bool // 写入标识
SDelete bool // 删除标识
SClear bool // 清除标识
SDB bool // 推送至DB
SRedis bool // 推送至Redis
Cond *xorm.Condition // 条件对象
}
管道对象维护
type PipeRecord ¶
type PipeRecord struct {
ID int64 // 批次ID
Tag interface{} // 批次标签
Time int // 开始时间
Objects []*PipeObject // 管道对象列表
Profiler *ProfilerRecord // 性能分析器
}
管道推送批次
type ProfilerRecord ¶
type ProfilerRecord struct {
Tag interface{} // 会话标签
Time int // 开始时间
RW bool // 是否读写
Log int // 日志层级
TID int64 // 线程ID
SID int64 // 会话ID
}
性能分析器
func (*ProfilerRecord) GLogAlert ¶
func (this *ProfilerRecord) GLogAlert(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func (*ProfilerRecord) GLogCritical ¶
func (this *ProfilerRecord) GLogCritical(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func (*ProfilerRecord) GLogDebug ¶
func (this *ProfilerRecord) GLogDebug(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func (*ProfilerRecord) GLogEmergency ¶
func (this *ProfilerRecord) GLogEmergency(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func (*ProfilerRecord) GLogError ¶
func (this *ProfilerRecord) GLogError(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func (*ProfilerRecord) GLogInfo ¶
func (this *ProfilerRecord) GLogInfo(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func (*ProfilerRecord) GLogNotice ¶
func (this *ProfilerRecord) GLogNotice(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
func (*ProfilerRecord) GLogWarn ¶
func (this *ProfilerRecord) GLogWarn(f interface{}, v ...interface{})
输出会话日志
priority: Debug(7) > Info(6) > Notice(5) > Warn(4) > Error(3) > Critical(2) > Alert(1) > Emergency(0)
type SessionObject ¶
type SessionObject struct {
Raw xorm.ITable // 原始对象
Ptr xorm.ITable // 工作对象
SWrite bool // 写入标识
SDelete bool // 删除标识
SClear bool // 清除标识
Cond *xorm.Condition // 条件对象
}
map[string]map[string]*GlobalObject map[string]bool map[string]map[string]int map[int]map[string]map[string]*SessionObject map[int]map[string]bool map[string]*DeleteRecord map[int64]int64 map[int64]*ProfilerRecord map[int64]*PipeRecord 会话自增ID 管道推送计数 会话对象维护