BaseToken

package
v5.2.7 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAll

func DeleteAll()

DeleteAll 将所有人踢下线

func DeleteByExpire

func DeleteByExpire()

DeleteByExpire 将所有过期人群踢下线

func DeleteByFrom

func DeleteByFrom(args *ArgsDeleteByFrom) (err error)

DeleteByFrom 删除某个From所有的数据

func DeleteByID

func DeleteByID(args *ArgsDeleteByID) (err error)

DeleteByID 删除

func DeleteByIDFrom

func DeleteByIDFrom(args *ArgsDeleteByIDFrom) (err error)

DeleteByIDFrom 删除指定范围的ID

func Run

func Run()

Run 维护程序

func UpdateExpire

func UpdateExpire(args *ArgsUpdateExpire) error

UpdateExpire 更新过期时间

func UpdateExpireByKey

func UpdateExpireByKey(args *ArgsUpdateExpireByKey) error

UpdateExpireByKey 根据Key更新过期时间

func UpdateExpireToValue

func UpdateExpireToValue(args *ArgsUpdateExpireToValue) error

UpdateExpireToValue 修改token的过期时间

Types

type ArgsClearAndCreate

type ArgsClearAndCreate struct {
	//要删除的tokenID
	OldTokenID int64
	//登陆来源
	FromInfo CoreSQLFrom.FieldsFrom
	//登陆渠道
	LoginInfo CoreSQLFrom.FieldsFrom
	//key长度限制
	LimitKeyLen int
	//IP地址
	IP string
	//过期时间
	// 请使用RFC3339Nano结构时间,eg: 2020-11-03T08:31:13.314Z
	// JS中使用new Date().toISOString()
	ExpireAt string
	//是否记住我
	IsRemember bool `db:"is_remember" json:"isRemember"`
}

ArgsClearAndCreate 登陆成功后的处理规则参数

type ArgsCreate deprecated

type ArgsCreate struct {
	//创建来源
	FromInfo CoreSQLFrom.FieldsFrom
	//登陆渠道
	LoginInfo CoreSQLFrom.FieldsFrom
	//登陆key长度限制
	LimitKeyLen int
	//IP地址
	IP string
	//过期时间
	// 请使用RFC3339Nano结构时间,eg: 2020-11-03T08:31:13.314Z
	// JS中使用new Date().toISOString()
	ExpireAt string
	//是否记住我
	IsRemember bool `db:"is_remember" json:"isRemember"`
}

Deprecated: 建议采用Create2 ArgsCreate 创建新的参数

type ArgsDeleteByFrom

type ArgsDeleteByFrom struct {
	//来源
	FromInfo CoreSQLFrom.FieldsFrom `json:"fromInfo"`
	//登陆渠道
	LoginInfo CoreSQLFrom.FieldsFrom `json:"loginInfo"`
}

ArgsDeleteByFrom 删除某个From所有的数据参数

type ArgsDeleteByID

type ArgsDeleteByID struct {
	//ID
	ID int64 `db:"id" json:"id"`
}

ArgsDeleteByID 删除参数

type ArgsDeleteByIDFrom

type ArgsDeleteByIDFrom struct {
	//ID
	ID int64 `db:"id" json:"id"`
	//来源
	FromInfo CoreSQLFrom.FieldsFrom `json:"fromInfo"`
}

ArgsDeleteByIDFrom 删除指定范围的ID参数

type ArgsGetByFromAndLogin

type ArgsGetByFromAndLogin struct {
	//来源
	FromInfo CoreSQLFrom.FieldsFrom
	//登陆渠道
	LoginInfo CoreSQLFrom.FieldsFrom
}

type ArgsGetByID

type ArgsGetByID struct {
	//ID
	ID int64
}

ArgsGetByID 获取token参数

type ArgsGetByKey

type ArgsGetByKey struct {
	//Key
	Key string
}

type ArgsGetList

type ArgsGetList struct {
	//分页
	Pages CoreSQLPages.ArgsDataList
	//来源
	FromInfo CoreSQLFrom.FieldsFrom
	//搜索
	Search string
}

ArgsGetList 获取token列表参数

type ArgsUpdateExpire

type ArgsUpdateExpire struct {
	//ID
	ID int64
	//过期时间
	// 请使用RFC3339Nano结构时间,eg: 2020-11-03T08:31:13.314Z
	// JS中使用new Date().toISOString()
	ExpireAt string
}

ArgsUpdateExpire 更新过期时间参数

type ArgsUpdateExpireByKey

type ArgsUpdateExpireByKey struct {
	//Key
	Key string
	//过期时间
	// 请使用RFC3339Nano结构时间,eg: 2020-11-03T08:31:13.314Z
	// JS中使用new Date().toISOString()
	ExpireAt string
}

ArgsUpdateExpireByKey 根据Key更新过期时间参数

type ArgsUpdateExpireToValue

type ArgsUpdateExpireToValue struct {
	//ID
	ID int64
	//过期时间
	// 请使用RFC3339Nano结构时间,eg: 2020-11-03T08:31:13.314Z
	// JS中使用new Date().toISOString()
	ExpireAt string
}

ArgsUpdateExpireToValue 修改token的过期时间参数

type FieldsTokenType

type FieldsTokenType struct {
	//ID
	ID int64 `db:"id" json:"id"`
	//创建时间
	CreateAt time.Time `db:"create_at" json:"createAt"`
	//更新时间
	UpdateAt time.Time `db:"update_at" json:"updateAt"`
	//过期时间
	ExpireAt time.Time `db:"expire_at" json:"expireAt"`
	//key
	// 钥匙,用于配对
	Key string `db:"key" json:"key"`
	//配对密钥
	// key + password和其他信息混合后,验证是否正确,该内容只有在刚开始下放给用户
	// 如果不存在则跳过
	Password string `db:"password" json:"password"`
	//来源结构体
	// system为来源系统
	// id为来源ID
	// name为名称,用于快速识别来源
	FromInfo CoreSQLFrom.FieldsFrom `db:"from_info" json:"fromInfo"`
	//登陆渠道信息
	// 渠道必须是唯一的,如果重叠,则自动剔除旧的
	// system为来源系统,例如来源于小程序,weixin-xiaochengxu; 或来源于手机客户端, phone-a...
	LoginInfo CoreSQLFrom.FieldsFrom `db:"login_info" json:"loginInfo"`
	//IP地址
	IP string `db:"ip" json:"ip"`
	//是否记住我
	IsRemember bool `db:"is_remember" json:"isRemember"`
}

FieldsTokenType 会话结构体

func ClearAndCreate

func ClearAndCreate(args *ArgsClearAndCreate) (data FieldsTokenType, errCode string, err error)

ClearAndCreate 登陆成功后的处理规则

func Create deprecated

func Create(args *ArgsCreate) (data FieldsTokenType, errCode string, err error)

Deprecated: 建议采用Create2 Create 创建新的

func Create2

func Create2(args *ArgsCreate) (data FieldsTokenType, errCode string, err error)

Create2 创建新的

func GetByFromAndLogin

func GetByFromAndLogin(args *ArgsGetByFromAndLogin) (data FieldsTokenType, err error)

func GetByID

func GetByID(args *ArgsGetByID) (data FieldsTokenType, err error)

GetByID 获取token

func GetByKey

func GetByKey(args *ArgsGetByKey) (data FieldsTokenType, err error)

func GetFilter

func GetFilter(token FieldsTokenType) FieldsTokenType

GetFilter 脱敏设计

func GetList

func GetList(args *ArgsGetList) (dataList []FieldsTokenType, dataCount int64, err error)

GetList 获取token列表

Jump to

Keyboard shortcuts

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