database

package
v0.0.0-...-0dd6052 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 20 Imported by: 3

Documentation

Index

Constants

View Source
const (
	PluginGuard    intent = 1 << iota // 守卫
	PluginBlock                       // 个人屏蔽
	PluginSwitch                      // 开关
	PluginRepeat                      // 复读
	PluginWCA                         // WCA
	PluginReply                       // 回复
	PluginAdmin                       // 频道管理
	PluginPrice                       // 查价
	PluginScramble                    // 打乱
	PluginLearn                       // 频道学习
)

Variables

View Source
var AllConfig = config.AllConfig()
View Source
var Db *sql.DB
View Source
var IntentMap = map[intent]string{
	PluginGuard:    "守卫",
	PluginBlock:    "屏蔽",
	PluginSwitch:   "开关",
	PluginRepeat:   "复读",
	PluginWCA:      "WCA",
	PluginReply:    "回复",
	PluginAdmin:    "频道管理",
	PluginPrice:    "查价",
	PluginScramble: "打乱",
	PluginLearn:    "学习",
}
View Source
var Pool *redis.Pool
View Source
var ScrambleIndexMap = map[string]int{
	"1": 1,
	"2": 2,
	"3": 3,
	"4": 4,
	"5": 5,
}
View Source
var ScrambleMap = map[string]string{
	"2":     "222",
	"3":     "333",
	"4":     "444",
	"5":     "555",
	"6":     "666",
	"7":     "777",
	"sk":    "skewb",
	"py":    "pyram",
	"sq":    "sq1",
	"cl":    "clock",
	"mx":    "minx",
	"fm":    "333fm",
	"222":   "222",
	"333":   "333",
	"444":   "444",
	"555":   "555",
	"666":   "666",
	"777":   "777",
	"skewb": "skewb",
	"pyram": "pyram",
	"sq1":   "sq1",
	"clock": "clock",
	"minx":  "minx",
	"333fm": "333fm",
}
View Source
var SwitchMap = map[string]intent{
	"守卫":   PluginGuard,
	"屏蔽":   PluginBlock,
	"开关":   PluginSwitch,
	"复读":   PluginRepeat,
	"WCA":  PluginWCA,
	"回复":   PluginReply,
	"频道管理": PluginAdmin,
	"查价":   PluginPrice,
	"打乱":   PluginScramble,
	"学习":   PluginLearn,
}

Functions

func ADBUAIAS

func ADBUAIAS(userId, item string, session int) (err error)

AchievementDeleteByUserIdAndItemAndSession

func ADBUAS

func ADBUAS(userId string, session int) (err error)

AchievementDeleteByUserIdAndSession

func AchievementGetCount

func AchievementGetCount(item string, best, average, session int) (i, j int, err error)

func AchievementSave

func AchievementSave(userId, userName string, avatar null.String, item string, best, average, session int) (err error)

func BestAndAverageTimeConvert

func BestAndAverageTimeConvert(b, a int) (bc, ac string)

func GetAll

func GetAll() (err error)

func GetScramble

func GetScramble(s string) string

func IDBGAN

func IDBGAN(guildId, channelId, item string) (err error)

ItemDeleteByGuildIdAndName

func IntentMean

func IntentMean(intent intent) string

func IsExist

func IsExist(groupId string) bool

func ItemSave

func ItemSave(guildId, channelId string, brand null.String, item string, price null.String, shipping null.String, updater null.String, gmtModified int64, is_magnetism bool, magnetism_type null.String) (id int64, err error)

func Judge

func Judge(str string, key JudgeKeys) string

func JudgeIndex

func JudgeIndex(str string, key JudgeKeys) int

func JudgeItem

func JudgeItem(str string, items []string) string

func LDBGAA

func LDBGAA(guildId, channelId, ask string) (err error)

func LearnSave

func LearnSave(ask, guildId, channelId, adminId string, answer null.String, gmtModified time.Time, pass bool) (err error)

func PBlockSave

func PBlockSave(guildId, userId, adminId string, ispblock bool, gmtModified time.Time) (err error)

func PathExists

func PathExists(path string) bool

func PluginNameToIntent

func PluginNameToIntent(s string) intent

func RedisGet

func RedisGet(key string) ([]byte, error)

func RedisRemove

func RedisRemove(key string)

func RedisSet

func RedisSet(key string, bw_set []byte)

func SDBGIACI

func SDBGIACI(guildId, channelId string) (err error)

SDBGI SwitchDeleteByGuildIdAndChannelId

func SwitchSave

func SwitchSave(guildId, channelId, adminId string, isCloseOrGuard int64, gmtModified time.Time, isClose bool) (err error)

func ToGetScramble

func ToGetScramble(s string) string

func ToGetScrambleIndex

func ToGetScrambleIndex(s string) int

func UID

func UID(userid, email, qq_union_id, weixin_union_id string) error

func UserInfoSave

func UserInfoSave(user_id, user_name, user_avatar, server_number, password, email, qq_union_id, weixin_union_id null.String, user_role int) (err error)

func WcaPersonHandler

func WcaPersonHandler(s string) string

Types

type Achievement

type Achievement struct {
	Id       int64
	UserId   string
	UserName string
	Avatar   null.String
	Item     string
	Best     int
	Average  int
	Session  int
}

func AGBIASOBAA

func AGBIASOBAA(item string, session int) (as []Achievement, err error)

AchievementGetByItemAndSessionOrderByAverageAsc desc 大 → 小 asc 小 → 大

func AGBIASOBBA

func AGBIASOBBA(item string, session int) (bs []Achievement, err error)

AchievementGetByItemAndSessionOrderByBestAsc desc 大 → 小 asc 小 → 大

func AGBSOBIAAAA

func AGBSOBIAAAA(session int) (as []Achievement, err error)

AchievementGetBySessionOrderByItemAscAndAverageAsc desc 大 → 小 asc 小 → 大

func AGBSOBIAABA

func AGBSOBIAABA(session int) (as []Achievement, err error)

AchievementGetBySessionOrderByItemAscAndBestAsc desc 大 → 小 asc 小 → 大

func AGBUAS

func AGBUAS(userId string, session int) (as []Achievement, err error)

AchievementGetByUserIdAndSession

func AchievementGet

func AchievementGet(userId, item string, session int) (a Achievement, err error)

func (*Achievement) AchievementCreate

func (a *Achievement) AchievementCreate() (err error)

func (*Achievement) AchievementUpdate

func (a *Achievement) AchievementUpdate() (err error)

type CompContent

type CompContent struct {
	Two      string
	Three    string
	Four     string
	Five     string
	Six      string
	Seven    string
	Skewb    string
	Pyraminx string
	Square   string
	Megaminx string
	Clock    string
}

func GetScrambles

func GetScrambles(s []string, n int) (string, CompContent, error)

type CompOptions

type CompOptions struct {
	Sessions     int
	StartTime    int64
	EndTime      int64
	Items        []string
	CompContents *CompContent
}

func CompetitionRead

func CompetitionRead() (c CompOptions, err error)

func (*CompOptions) CompetitionCreate

func (c *CompOptions) CompetitionCreate(day int, si []string) (err error)

func (*CompOptions) CompetitionUpdate

func (c *CompOptions) CompetitionUpdate(sa []string) (tip string, err error)

type CuberPrice

type CuberPrice struct {
	Id            int64       `json:"id"`
	GuildId       string      `json:"guild_id"`
	ChannelId     string      `json:"channel_id"`
	Brand         null.String `json:"brand"`
	Item          string      `json:"item"`
	Price         null.String `json:"price"`
	Shipping      null.String `json:"shipping"`
	Updater       null.String `json:"updater"`
	GmtModified   int64       `json:"gmt_modified"`
	IsMagnetism   bool        `json:"is_magnetism"`
	MagnetismType null.String `json:"magnetism_type"`
}

func GetItem

func GetItem(guildId, channelId string, item string) (cp CuberPrice, err error)

is_magnetism

func GetItems

func GetItems(guildId, channelId string, key string) (cps []CuberPrice, err error)

func GetItemsAll

func GetItemsAll(guildId, channelId string) (cps []CuberPrice, err error)

func (*CuberPrice) ItemCreate

func (cp *CuberPrice) ItemCreate() (id int64, err error)

func (*CuberPrice) ItemDeleteById

func (cp *CuberPrice) ItemDeleteById() (err error)

func (*CuberPrice) ItemUpdate

func (cp *CuberPrice) ItemUpdate() (err error)

type Info

type Info struct {
	Msg                  string `json:"msg"`
	PageLast             bool   `json:"pageLast"`
	PageEmpty            bool   `json:"pageEmpty"`
	Data                 []PeopleInfo
	TotalPages           int  `json:"totalPages"`
	PageFirst            bool `json:"pageFirst"`
	PageSize             int  `json:"pageSize"`
	PageNumberOfElements int  `json:"pageNumberOfElements"`
	PageNum              int  `json:"pageNum"`
	Retcode              int  `json:"retcode"`
	TotalElements        int  `json:"totalElements"`
}

type JudgeKeys

type JudgeKeys struct {
	Keys []string
}

func JudgeKeysRead

func JudgeKeysRead() (k JudgeKeys, err error)

func (*JudgeKeys) JudgeKeysCreate

func (k *JudgeKeys) JudgeKeysCreate() error

type JudgekeysSync

type JudgekeysSync struct {
	IsTrue        bool
	JudgekeysSync *JudgeKeys
}

func GetJudgeKeys

func GetJudgeKeys() (key JudgekeysSync, err error)

func (*JudgekeysSync) JudgeKeysDelete

func (k *JudgekeysSync) JudgeKeysDelete(dk ...string)

func (*JudgekeysSync) JudgeKeysUpdate

func (k *JudgekeysSync) JudgeKeysUpdate(uk ...string) error

type Learn

type Learn struct {
	Id          int64
	Ask         string
	GuildId     string
	ChannelId   string
	AdminId     string
	Answer      null.String
	GmtModified time.Time
	Pass        bool
}

func LearnGet

func LearnGet(guildId, channelId, ask string) (l Learn, err error)

func (*Learn) LDBGIAAACI

func (learn *Learn) LDBGIAAACI() (err error)

LearnDeleteByGuildIdAndAskAndChannelId

func (*Learn) LearnCreate

func (learn *Learn) LearnCreate() (err error)

func (*Learn) LearnUpdate

func (learn *Learn) LearnUpdate() (err error)

type PBlock

type PBlock struct {
	Id          int       `json:"id"`
	GuildId     string    `json:"guild_id"`
	UserId      string    `json:"user_id"`
	IsPBlock    bool      `json:"ispblock"`
	AdminId     string    `json:"admin_id"`
	GmtModified time.Time `json:"gmt_modified"`
}

func PBlockGet

func PBlockGet(guildId, userId string) (p PBlock, err error)

func (*PBlock) PBlockCreate

func (pBlock *PBlock) PBlockCreate() (err error)

func (*PBlock) PBlockUpdate

func (pBlock *PBlock) PBlockUpdate() (err error)

type PeopleInfo

type PeopleInfo struct {
	CountryId string `json:"countryId"`
	Gender    string `json:"gender"`
	Id        string `json:"id"`
	Name      string `json:"name"`
	SubId     int    `json:"subId"`
}

type PeopleRankInfo

type PeopleRankInfo struct {
	Best          int    `json:"best"`
	ContinentRank int    `json:"continentRank"`
	CountryRank   string `json:"countryRank"`
	EventId       string `json:"eventId"`
	PersonId      string `json:"personId"`
	WorldRank     int    `json:"worldRank"`
}

type RankInfo

type RankInfo struct {
	Msg                  string `json:"msg"`
	PageLast             bool   `json:"pageLast"`
	PageEmpty            bool   `json:"pageEmpty"`
	Data                 []PeopleRankInfo
	TotalPages           int  `json:"totalPages"`
	PageFirst            bool `json:"pageFirst"`
	PageSize             int  `json:"pageSize"`
	PageNumberOfElements int  `json:"pageNumberOfElements"`
	PageNum              int  `json:"pageNum"`
	Retcode              int  `json:"retcode"`
	TotalElements        int  `json:"totalElements"`
}

type Scramble

type Scramble struct {
	Instruction string
	ShortName   string
	ShowName    string
}

func Tnoodle

func Tnoodle(scramble string) (s Scramble)

type ServerAuthSet

type ServerAuthSet struct {
	Groups []string
}

func ServerAuthsRead

func ServerAuthsRead() (s ServerAuthSet, err error)

func (*ServerAuthSet) ServerAuthsSet

func (s *ServerAuthSet) ServerAuthsSet() error

type ServerAuthSetSync

type ServerAuthSetSync struct {
	IsTrue            bool
	ServerAuthSetSync *ServerAuthSet
}

func ServerAuthsGet

func ServerAuthsGet() (s ServerAuthSetSync, err error)

func (*ServerAuthSetSync) ServerAuthUpdate

func (s *ServerAuthSetSync) ServerAuthUpdate(groupId string) error

func (*ServerAuthSetSync) ServerAuthsDelete

func (s *ServerAuthSetSync) ServerAuthsDelete(groupId string)

type Switch

type Switch struct {
	Id             int       `json:"id"`
	GuildId        string    `json:"guild_id"`
	ChannelId      string    `json:"channel_id"`
	IsCloseOrGuard int64     `json:"is_close_or_guard"`
	AdminId        string    `json:"admin_id"`
	GmtModified    time.Time `json:"gmt_modified"`
}

func (*Switch) SwitchCreate

func (bot_switch *Switch) SwitchCreate() (err error)

func (*Switch) SwitchUpdate

func (bot_switch *Switch) SwitchUpdate() (err error)

type SwitchSync

type SwitchSync struct {
	IsTrue       bool `json:"synchronization"`
	PluginSwitch *Switch
}

func SGBGIACI

func SGBGIACI(guildId, channelId string) (bot_switch_sync SwitchSync, err error)

SGBGI SwitchGetByGuildIdAndChannelId

type TCuberPrice

type TCuberPrice struct {
	Id            int64       `json:"id"`
	GuildId       string      `json:"guild_id"`
	ChannelId     string      `json:"channel_id"`
	Brand         null.String `json:"brand"`
	Item          string      `json:"item"`
	Price         null.String `json:"price"`
	Shipping      null.String `json:"shipping"`
	Updater       null.String `json:"updater"`
	GmtModified   null.Time   `json:"gmt_modified"`
	IsMagnetism   bool        `json:"is_magnetism"`
	MagnetismType null.String `json:"magnetism_type"`
}

type UserInfo

type UserInfo struct {
	Id            int64       `json:"id"`
	UserId        null.String `json:"user_id"`
	Username      null.String `json:"user_name"`
	UserRole      int         `json:"user_role"` // 1<<1 黄小姐 1<<2 奇乐 1<<30 系统
	UserAvatar    null.String `json:"user_avatar"`
	ServerNumber  null.String `json:"server_number"`
	Password      null.String `json:"password"`
	Email         null.String `josn:"email"`
	QQUnionId     null.String `json:"qq_union_id"`
	WeixinUnionId null.String `json:"weixin_union_id"`
}

func UserInfoGet

func UserInfoGet(userid, email, qq_union_id, weixin_union_id string) (ui UserInfo, err error)

func UserInfoGetByBot

func UserInfoGetByBot(userid string) (ui UserInfo, err error)

func (*UserInfo) UserInfoCreate

func (ui *UserInfo) UserInfoCreate() error

user_info

func (*UserInfo) UserInfoDelete

func (ui *UserInfo) UserInfoDelete() error

func (*UserInfo) UserInfoUpdate

func (ui *UserInfo) UserInfoUpdate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL