db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID              int
	Region          string
	Tag             string
	IGN             string
	Username        string
	Password        string
	User            string
	Leaverbuster    int
	Ban             NullTime
	Perma           bool
	PasswordChanged bool
	Pre30           bool
	Elo             string
}

type DB

type DB struct {
	// contains filtered or unexported fields
}

func Init

func Init(ctx context.Context, path string) (*DB, error)

func (DB) Account

func (db DB) Account(ctx context.Context, id int) (*Account, error)

func (DB) Accounts

func (db DB) Accounts(ctx context.Context) ([]*Account, error)

func (DB) AddAccount

func (db DB) AddAccount(ctx context.Context, acc *Account) error

func (DB) AddUser

func (db DB) AddUser(ctx context.Context, username, password string) error

func (DB) Close

func (db DB) Close() error

func (DB) EditAccount

func (db DB) EditAccount(ctx context.Context, id int, acc *Account) error

func (DB) EditElo

func (db DB) EditElo(ctx context.Context, id int, elo string) error

func (DB) EditToken

func (db DB) EditToken(ctx context.Context, id int, token string) error

func (DB) RemoveAccount

func (db DB) RemoveAccount(ctx context.Context, id int) error

func (DB) RemoveUser

func (db DB) RemoveUser(ctx context.Context, username string) error

func (DB) User

func (db DB) User(ctx context.Context, username string) (*User, error)

func (DB) UserByToken

func (db DB) UserByToken(ctx context.Context, token string) (*User, error)

func (DB) Usernames

func (db DB) Usernames(ctx context.Context) ([]string, error)

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool
}

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

type User

type User struct {
	ID       int
	Username string
	Password string
	Token    string
}

Jump to

Keyboard shortcuts

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