db

package
v0.0.0-...-c4d5803 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNil = errors.New("no matching records found in redis database")
	Ctx    = context.TODO()
)

Functions

This section is empty.

Types

type Database

type Database struct {
	Client *redis.Client
}

func NewDatabase

func NewDatabase(address string) (*Database, error)

func (*Database) GetLeaderboard

func (db *Database) GetLeaderboard() (*Leaderboard, error)

func (*Database) GetUser

func (db *Database) GetUser(username string) (*User, error)

func (*Database) SaveUser

func (db *Database) SaveUser(user *User) error

type Leaderboard

type Leaderboard struct {
	Count int
	Users []*User
}

type User

type User struct {
	Username string `json:"username" form:"username" query:"username"`
	Points   int    `json:"points" form:"points" query:"points"`
	Rank     int    `json:"rank"`
}

Jump to

Keyboard shortcuts

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