Version: v0.0.0-...-e05cf37 Latest Latest

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

Go to latest
Published: Mar 1, 2021 License: MIT Imports: 6 Imported by: 0




This section is empty.


This section is empty.


func Cleanup

func Cleanup()

Cleanup cleans up any db resources

func InitDB

func InitDB() error

InitDB initializes the database

func TestUser

func TestUser(t *testing.T)


type Entity

type Entity interface {
	Insert() error
	Save() error

Entity represents the generic type of db entity

type User

type User struct {
	FullName    string
	DisplayName string
	Username    string
	Password    []byte
	LastLogin   time.Time

User contains data for a user of the game

func AddNewUser

func AddNewUser(fullname, displayname, username, password string) (*User, error)

AddNewUser creates a new user and inserts it into the DB

func FindUserByUsername

func FindUserByUsername(username string) *User

FindUserByUsername finds the user based on the username

func (*User) HashAndSalt

func (u *User) HashAndSalt(value string) error

HashAndSalt converts password to hashed value

func (User) Insert

func (u User) Insert() error

Insert inserts the record into the db This does not check to see if the records already exists; it assumes it does not.

func (User) Save

func (u User) Save() error

Save will insert or update the record, based on whether it has a primary key or not

func (User) VerifyPassword

func (u User) VerifyPassword(password string) error

VerifyPassword will validate the given password

Jump to

Keyboard shortcuts

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