Documentation
¶
Index ¶
- Variables
- func AttrGroupGetAll(db *sqlx.DB, groupID string) []byte
- func AttrGroupSave(db *sqlx.DB, groupID string, data []byte)
- func AttrGroupUserGetAll(db *sqlx.DB, groupID string, userID string) []byte
- func AttrGroupUserSave(db *sqlx.DB, groupID string, userID string, data []byte)
- func AttrUserGetAll(db *sqlx.DB, userID string) []byte
- func AttrUserSave(db *sqlx.DB, userID string, data []byte)
- func BanItemDel(db *sqlx.DB, id string) error
- func BanItemList(db *sqlx.DB, callback func(id string, banUpdatedAt int64, data []byte)) error
- func BanItemSave(db *sqlx.DB, id string, updatedAt int64, banUpdatedAt int64, data []byte) error
- func CensorAppend(db *sqlx.DB, msgType string, userID string, groupID string, content string, ...) bool
- func CensorClearLevelCount(db *sqlx.DB, userID string, level censor.Level)
- func CensorCount(db *sqlx.DB, userID string) map[censor.Level]int
- func DBCacheDelete() bool
- func DBCheck(dataDir string)
- func DBVacuum()
- func FlushWAL(db *sqlx.DB) error
- func GroupInfoListGet(db *sqlx.DB, callback func(id string, updatedAt int64, data []byte)) error
- func GroupInfoSave(db *sqlx.DB, groupID string, updatedAt int64, data []byte) error
- func GroupPlayerInfoSave(db *sqlx.DB, groupID string, playerID string, info *GroupPlayerInfoBase) error
- func GroupPlayerNumGet(db *sqlx.DB, groupID string) (int64, error)
- func LogAppend(db *sqlx.DB, groupID string, logName string, logItem *LogOneItem) bool
- func LogDelete(db *sqlx.DB, groupID string, logName string) bool
- func LogEditByMsgID(db *sqlx.DB, groupID, logName, newContent string, rawID interface{}) error
- func LogGetIDByGroupIDAndName(db *sqlx.DB, groupID string, logName string) (logID int64, err error)
- func LogGetInfo(db *sqlx.DB) ([]int, error)
- func LogGetList(db *sqlx.DB, groupID string) ([]string, error)
- func LogGetUploadInfo(db *sqlx.DB, groupID string, logName string) (url string, uploadTime, updateTime int64, err error)
- func LogLinesCountGet(db *sqlx.DB, groupID string, logName string) (int64, bool)
- func LogMarkDeleteByMsgID(db *sqlx.DB, groupID string, logName string, rawID interface{}) error
- func LogSetUploadInfo(db *sqlx.DB, groupID string, logName string, url string) error
- func SQLiteCensorDBInit(dataDir string) (censorDB *sqlx.DB, err error)
- func SQLiteDBInit(dataDir string) (dataDB *sqlx.DB, logsDB *sqlx.DB, err error)
- func Vacuum(db *sqlx.DB, path string) error
- type CensorLog
- type EndpointInfo
- type GroupPlayerInfoBase
- type LogInfo
- type LogOne
- type LogOneItem
- type PlayerVariablesItem
- type QueryCensorLog
- type QueryLogLinePage
- type QueryLogPage
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEndpointInfoUIDEmpty = errors.New("user id is empty")
Functions ¶
func AttrGroupUserGetAll ¶
func AttrGroupUserSave ¶
func BanItemList ¶
func BanItemSave ¶
func CensorAppend ¶
func CensorClearLevelCount ¶
func DBCacheDelete ¶
func DBCacheDelete() bool
func GroupInfoListGet ¶
func GroupInfoSave ¶
GroupInfoSave 保存群组信息
func GroupPlayerInfoSave ¶
func GroupPlayerNumGet ¶
GroupPlayerNumGet 查询指定群组中玩家数量
func LogEditByMsgID ¶
func LogGetIDByGroupIDAndName ¶
LogGetIDByGroupIDAndName 获取ID
func LogGetUploadInfo ¶
func LogLinesCountGet ¶
LogLinesCountGet 获取日志行数
func LogMarkDeleteByMsgID ¶
LogMarkDeleteByMsgID 撤回删除
func LogSetUploadInfo ¶
Types ¶
type CensorLog ¶
type CensorLog struct {
ID uint64 `json:"id"`
MsgType string `json:"msgType"`
UserID string `json:"userId"`
GroupID string `json:"groupId"`
Content string `json:"content"`
HighestLevel int `json:"highestLevel"`
CreatedAt int `json:"createdAt"`
}
func CensorGetLogPage ¶
type EndpointInfo ¶
type GroupPlayerInfoBase ¶
type GroupPlayerInfoBase struct {
Name string `yaml:"name" jsbind:"name"` // 玩家昵称
UserID string `yaml:"userId" jsbind:"userId"`
InGroup bool `yaml:"inGroup"` // 是否在群内,有时一个人走了,信息还暂时残留
LastCommandTime int64 `yaml:"lastCommandTime" jsbind:"lastCommandTime"` // 上次发送指令时间
RateLimiter *rate.Limiter `yaml:"-"` // 限速器
RateLimitWarned bool `yaml:"-"` // 是否已经警告过限速
AutoSetNameTemplate string `yaml:"autoSetNameTemplate" jsbind:"autoSetNameTemplate"` // 名片模板
// level int 权限
DiceSideNum int `yaml:"diceSideNum"` // 面数,为0时等同于d100
Vars *PlayerVariablesItem `yaml:"-"` // 玩家的群内变量
ValueMapTemp lockfree.HashMap `yaml:"-"` // 玩家的群内临时变量
TempValueAlias *map[string][]string `yaml:"-"` // 群内临时变量别名 - 其实这个有点怪的,为什么在这里?
UpdatedAtTime int64 `yaml:"-" json:"-"`
RecentUsedTime int64 `yaml:"-" json:"-"`
}
GroupPlayerInfoBase 群内玩家信息
func GroupPlayerInfoGet ¶
func GroupPlayerInfoGet(db *sqlx.DB, groupID string, playerID string) *GroupPlayerInfoBase
type LogInfo ¶
type LogInfo struct {
ID uint64 `json:"id" db:"id"`
Name string `json:"name" db:"name"`
GroupID string `json:"groupId" db:"groupId"`
CreatedAt int64 `json:"createdAt" db:"created_at"`
UpdatedAt int64 `json:"updatedAt" db:"updated_at"`
Size int `json:"size" db:"size"`
}
func LogGetLogPage ¶
LogGetLogPage 获取分页
func LogGetLogs
deprecated
type LogOne ¶
type LogOne struct {
// Version int `json:"version,omitempty"`
Items []LogOneItem `json:"items"`
Info LogInfo `json:"info"`
}
type LogOneItem ¶
type LogOneItem struct {
ID uint64 `json:"id" db:"id"`
Nickname string `json:"nickname" db:"nickname"`
IMUserID string `json:"IMUserId" db:"im_userid"`
Time int64 `json:"time" db:"time"`
Message string `json:"message" db:"message"`
IsDice bool `json:"isDice" db:"is_dice"`
CommandID int64 `json:"commandId" db:"command_id"`
CommandInfo interface{} `json:"commandInfo" db:"command_info"`
RawMsgID interface{} `json:"rawMsgId" db:"raw_msg_id"`
UniformID string `json:"uniformId" db:"user_uniform_id"`
Channel string `json:"channel"`
}
func LogGetAllLines ¶
LogGetAllLines 获取log的所有行数据
func LogGetLinePage ¶
func LogGetLinePage(db *sqlx.DB, param *QueryLogLinePage) ([]*LogOneItem, error)
LogGetLinePage 获取log的行分页
type PlayerVariablesItem ¶
type QueryCensorLog ¶
type QueryLogLinePage ¶
type QueryLogPage ¶
type QueryLogPage struct {
PageNum int `db:"page_num" query:"pageNum"`
PageSize int `db:"page_siz" query:"pageSize"`
Name string `db:"name" query:"name"`
GroupID string `db:"group_id" query:"groupId"`
CreatedTimeBegin string `db:"created_time_begin" query:"createdTimeBegin"`
CreatedTimeEnd string `db:"created_time_end" query:"createdTimeEnd"`
}
Click to show internal directories.
Click to hide internal directories.