setutime

package
v0.0.0-...-312110e Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	POOL = NewPools()
)

Functions

func FirstValueInList

func FirstValueInList(list []string) zero.Rule

FirstValueInList 判断正则匹配的第一个参数是否在列表中

func Init

func Init(c Config)

func Min

func Min(a, b int) int

Min 返回两数最小值

Types

type Config

type Config struct {
	Enable bool
}

type Pool

type Pool struct {
	Lock  sync.Mutex
	DB    *Sqlite
	Path  string
	Group int64
	List  []string
	Max   int
	Pool  map[string][]*pixiv.Illust
	Form  int64
}

Pools 图片缓冲池

func NewPools

func NewPools() *Pool

NewPoolsCache 返回一个缓冲池对象

func (*Pool) IsFull

func (p *Pool) IsFull(type_ string) bool

IsFull 返回缓冲池指定类型是否已满

func (*Pool) Pop

func (p *Pool) Pop(type_ string) (illust *pixiv.Illust)

Push 在缓冲池拿出一张图片

func (*Pool) Push

func (p *Pool) Push(type_ string, illust *pixiv.Illust)

Push 向缓冲池插入一张图片

func (*Pool) Size

func (p *Pool) Size(type_ string) int

Size 返回缓冲池指定类型的现有大小

type Sqlite

type Sqlite struct {
	DB     *sql.DB
	DBPath string
}

Sqlite 数据库对象

func (*Sqlite) Create

func (db *Sqlite) Create(table string, objptr interface{}) (err error)

Create 生成数据库 默认结构体的第一个元素为主键 返回错误

func (*Sqlite) Delete

func (db *Sqlite) Delete(table string, condition string) (err error)

Delete 删除数据库 condition 可为"WHERE id = 0" 返回错误

func (*Sqlite) Insert

func (db *Sqlite) Insert(table string, objptr interface{}) (err error)

Insert 插入数据集 默认结构体的第一个元素为主键 返回错误

func (*Sqlite) Num

func (db *Sqlite) Num(table string) (num int, err error)

Num 查询数据库行数 返回行数以及错误

func (*Sqlite) Select

func (db *Sqlite) Select(table string, objptr interface{}, condition string) (err error)

Select 查询数据库 condition 可为"WHERE id = 0" 默认字段与结构体元素顺序一致 返回错误

Jump to

Keyboard shortcuts

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