storage

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrHasExist

func ErrHasExist(s string) error

ErrHasExist error: has exist

func ErrNotFound

func ErrNotFound(s string) error

ErrNotFound error not found

func IsHasExistError

func IsHasExistError(err error) bool

IsHasExistError check error

func IsNotFoundError

func IsNotFoundError(err error) bool

IsNotFoundError check error

Types

type HistoryRecord

type HistoryRecord struct {
	ID          int64  `json:"id" db:"id"`
	UserSlug    string `json:"user_slug" db:"user_slug"`
	IsCN        int    `json:"is_cn" db:"is_cn"`
	Ranking     int    `json:"ranking" db:"ranking"`
	SolvedNum   int    `json:"solved_num" db:"solved_num"`
	ZeroTime    int64  `json:"zero_time" db:"zero_time"`
	CreatedTime int64  `json:"created_time" db:"created_time"`
}

HistoryRecord record info

type Storage

type Storage interface {
	GetUserInfo(userSlug string, isCN bool) ([]UserInfo, error)
	SaveUserInfo(info UserInfo) (int64, error)
	ListUserInfo(start, limit int) ([]UserInfo, error)

	ListRecord(userSlug string, isCN bool, start, end time.Time) ([]HistoryRecord, error)
	SaveRecord(info HistoryRecord) error
}

type UserInfo

type UserInfo struct {
	ID          int64  `json:"id" db:"id"`
	UserSlug    string `json:"user_slug" db:"user_slug"`
	IsCN        int    `json:"is_cn" db:"is_cn"`
	RealName    string `json:"real_name" db:"real_name"`
	UserAvatar  string `json:"user_avatar" db:"user_avatar"`
	UpdatedTime int64  `json:"updated_time" db:"updated_time"`
	CreatedTime int64  `json:"created_time" db:"created_time"`
}

UserInfo user info

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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