user

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Tokens = make(map[string]User)
	Uids   = make(map[string]string)
)
View Source
var ErrNotListeningList = errors.New("不是一个好的监听列表")

监听列表获取错误

Functions

func Connect

func Connect(dialector gorm.Dialector)

func Done

func Done(uid string)

清理

func GetRandomToken

func GetRandomToken(uid string) (auth, token string)

获取随机 Token

func MakeUrl

func MakeUrl(OID string)

构建网址

Types

type ApiData

type ApiData struct {
	Code int       `json:"code"`
	Data []Replies `json:"data"`
}

type Job

type Job struct {
	// 数据库内序号
	ID     int64  `gorm:"primaryKey;autoIncrement" json:"-"`
	Patten string `form:"patten" json:"patten" yaml:"patten"`
	request.Job
}

回调任务封装

func (Job) Match

func (j Job) Match(s string) bool

匹配

func (Job) String

func (j Job) String() string

转字符串

type Jobs

type Jobs []Job

func GetJobsByRegexp

func GetJobsByRegexp(platform, uid string) (js Jobs)

正则匹配任务

func (*Jobs) Scan

func (js *Jobs) Scan(val any) error

func (*Jobs) ToString

func (js *Jobs) ToString() string

转字符串

func (Jobs) Value

func (js Jobs) Value() (driver.Value, error)

type Listening

type Listening []string

监听列表的读取实现

func (*Listening) Scan

func (l *Listening) Scan(val any) error

func (Listening) Value

func (l Listening) Value() (driver.Value, error)

type Replies

type Replies struct {
	Member struct {
		Mid   string `json:"mid"`
		Uname string `json:"uname"`
	} `json:"member"`
	Content struct {
		Message string `json:"message"`
	} `json:"content"`
}

func GetReplies

func GetReplies() ([]Replies, error)

返回最近回复

type User

type User struct {
	Uid        string  `gorm:"primaryKey" json:"uid"`
	Token      string  `json:"-"`
	Permission float64 `json:"permission"`
	Jobs       `form:"jobs" json:"-"`
	Listening  `form:"listening" json:"-"`
}

用户

func Get

func Get(auth string) User

func (*User) LevelUP

func (u *User) LevelUP()

升级

func (*User) Make

func (u *User) Make(uid string) *User

构造函数

func (User) MatchReplies

func (u User) MatchReplies() (bool, error)

检查回复

func (*User) Query

func (u *User) Query(token string) *User

根据 uid 查询

func (*User) Scan

func (u *User) Scan(val any) error

func (User) Value

func (u User) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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