entity

package
v0.0.0-...-693af1c Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput     = Error{Err: "Invalid Input"}
	ErrBadSession       = Error{Err: "Bad Session"}
	ErrUserCreateFailed = Error{Err: "Could not create user"}
	ErrUserExists       = Error{Err: "A user with that name already exists"}
	ErrUserDoesNotExist = Error{Err: "User does not exist, you must register first"}
	ErrDatabaseError    = Error{Err: "Database Error"}
	ErrForbidden        = Error{Err: "Forbidden"}
	ErrUnauthorised     = Error{Err: "Unauthorised"}
	ErrInvalidLobby     = Error{Err: "Invalid Lobby ID"}
	ErrLobbyNotFound    = Error{Err: "Lobby Not Found"}
	ErrLobbyNotJoined   = Error{Err: "You are not a member of this lobby"}
	ErrLobbyJoined      = Error{Err: "You are already a member of this lobby"}
	ErrLobbyFull        = Error{Err: "Lobby is full"}
	ErrLoggedIn         = Error{Err: "You must be logged out to use this endpoint"}
	ErrSpectating       = Error{Err: "You must be an active participant in the game to use this endpoint"}
	ErrNotYourTurn      = Error{Err: "It is not currently your turn"}
	ErrTileOccupied     = Error{Err: "Tile is already occupied"}
	ErrInvalidPlay      = Error{Err: "Invalid tile placement"}
	ErrGameInProgress   = Error{Err: "Game is already in progress"}
)

Functions

This section is empty.

Types

type Bonus

type Bonus struct {
	LetterMultiplier int    `json:"letterMultiplier,omitempty"`
	WordMultiplier   int    `json:"wordMultiplier,omitempty"`
	Start            bool   `json:"start,omitempty"`
	Text             string `json:"text"`
	Type             string `json:"type"`
}

type ChatSent

type ChatSent struct {
	Message string `json:"message"`
	Author  string `json:"author"`
}

type CreateLobby

type CreateLobby struct {
	Name     string `json:"name"`
	Private  bool   `json:"private"`
	GameType uint32 `json:"gameType"`
}

type DeleteMember

type DeleteMember struct {
	UserID *uint32 `json:"id"`
}

type Error

type Error struct {
	Err string `json:"err"`
}

type LobbyState

type LobbyState string
const (
	LobbyWaitingForPlayers LobbyState = "waiting"
	LobbyInGame            LobbyState = "inGame"
	LobbyRoundOver         LobbyState = "roundOver"
)

type MoveTile

type MoveTile struct {
	From      string `json:"from"`
	FromIndex int    `json:"fromIndex"`
	To        string `json:"to"`
	ToIndex   int    `json:"toIndex"`
	Letter    string `json:"letter,omitempty"`
}

type PutMember

type PutMember struct {
	// Join codes, for later
	Code string              `json:"code"`
	Type constant.MemberType `json:"type"`
}

type Register

type Register struct {
	Nickname string `json:"nickname"`
}

type SendChat

type SendChat struct {
	Message string `json:"message"`
}

type Square

type Square struct {
	Tile  *Tile  `json:"tile,omitempty"`
	Bonus *Bonus `json:"bonus,omitempty"`
}

type SquareSet

type SquareSet struct {
	Squares *[]Square `json:"squares"`
	Width   int       `json:"width,omitempty"`
	Height  int       `json:"height,omitempty"`
}

SquareSet exists to make GORM happy about using the JSON datatype

func (*SquareSet) AddTiles

func (t *SquareSet) AddTiles(squares []Square)

func (*SquareSet) GormDBDataType

func (t *SquareSet) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (*SquareSet) GormDataType

func (t *SquareSet) GormDataType() string

func (*SquareSet) Scan

func (t *SquareSet) Scan(src interface{}) error

func (*SquareSet) TileCount

func (t *SquareSet) TileCount() int

func (*SquareSet) Value

func (t *SquareSet) Value() (driver.Value, error)

type Tile

type Tile struct {
	Letter    string `json:"letter"`
	Score     int    `json:"score"`
	Draggable bool   `json:"draggable,omitempty"`
	Blank     bool   `json:"blank,omitempty"`
}

type UpdateLobby

type UpdateLobby struct {
	State LobbyState `json:"state,omitempty"`
}

Jump to

Keyboard shortcuts

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