ticket

package
v0.0.0-...-ddfd2c2 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Del

func Del(k string) error

删除记录

func Init

func Init(conf *config.ViperConfig)

在单实例模式下,是用内存缓存 tickets,在集群模式下,使用数据库存储 tickets 可以共享

func Range

func Range(f func(k string, e *TicketEntry) bool)

遍历

func Set

func Set(k string, e *TicketEntry) error

增加记录,如果存在则更新, t 是记录的 key

Types

type TicketEntry

type TicketEntry struct {
	KeyID    string `db:"keyid"`     // key
	CreateAt int64  `db:"create_at"` // 创建时间
	ExpiryAt int64  `db:"expiry_at"` // 过期时间
	Code     string `db:"code"`      // 代码
	Failed   int    `db:"failed"`    // 失败次数
	UserData string `db:"user_data"` // 用户数据
}

func Get

func Get(k string) (*TicketEntry, error)

获取记录

Jump to

Keyboard shortcuts

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