score

package
v1.2.3-beta4 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package score 签到,答题得分

Index

Constants

View Source
const (

	// ScoreMax 分数上限定为120
	ScoreMax = 120
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB gorm.DB

DB 分数数据库

var SDB *DB

SDB 得分数据库

func Initialize

func Initialize(dbpath string) *DB

Initialize 初始化ScoreDB数据库

func Open

func Open(dbpath string) (*DB, error)

Open ...

func (*DB) Close

func (sdb *DB) Close() error

Close ...

func (*DB) GetScoreByUID

func (sdb *DB) GetScoreByUID(uid int64) (s Score)

GetScoreByUID 取得分数

func (*DB) GetSignInByUID

func (sdb *DB) GetSignInByUID(uid int64) (si SignIn)

GetSignInByUID 取得签到次数

func (*DB) InsertOrUpdateScoreByUID

func (sdb *DB) InsertOrUpdateScoreByUID(uid int64, score int) (err error)

InsertOrUpdateScoreByUID 插入或更新分数

func (*DB) InsertOrUpdateSignInCountByUID

func (sdb *DB) InsertOrUpdateSignInCountByUID(uid int64, count int) (err error)

InsertOrUpdateSignInCountByUID 插入或更新签到次数

type Score

type Score struct {
	UID   int64 `gorm:"column:uid;primary_key"`
	Score int   `gorm:"column:score;default:0"`
}

Score 分数结构体

func (Score) TableName

func (Score) TableName() string

TableName ...

type SignIn

type SignIn struct {
	UID       int64 `gorm:"column:uid;primary_key"`
	Count     int   `gorm:"column:count;default:0"`
	UpdatedAt time.Time
}

SignIn 签到结构体

func (SignIn) TableName

func (SignIn) TableName() string

TableName ...

Jump to

Keyboard shortcuts

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