db

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CharacterNameExists

func CharacterNameExists(characterName string) bool

CharacterNameExists checks to see if a character name exists

func Setup

func Setup(ctx context.Context, dbName, dbUser, dbPassword string)

Setup connects to database instance

func UserNameExists

func UserNameExists(userName string) bool

UserNameExists checks to see if a user name exists

Types

type Connection

type Connection struct {
	gorm.Model
	RoomID      uint
	NeighbourID uint
	Dir         core.Direction
	TwoWay      bool
}

Connection describes the connection between two rooms

type Room

type Room struct {
	gorm.Model
	Name        string
	Description string
	Connections []Connection
}

Room describes a room

func GetRooms

func GetRooms() []Room

GetRooms gets all rooms

type User

type User struct {
	gorm.Model
	UserName      string
	CharacterName string
	PasswordHash  string
}

User describes a logged on character

func CreateUser

func CreateUser(userName, password, characterName string) *User

CreateUser creates a new user

func Login

func Login(userName, password string) *User

Login returns a user if it exists

Jump to

Keyboard shortcuts

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