data

package
v0.0.0-...-ab9ee8d Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ability

type Ability struct {
	ID           int            `db:"id"`
	Name         string         `db:"name"`
	Description  string         `db:"description"`
	Charges      int            `db:"charges"`
	AnyAbility   bool           `db:"any_ability"`
	RoleSpecific string         `db:"role_specific"`
	Rarity       string         `db:"rarity"`
	Categories   pq.StringArray `db:"categories"`
}

type AbilityModel

type AbilityModel struct {
	*sqlx.DB
}

func (*AbilityModel) Get

func (am *AbilityModel) Get(id int) (*Ability, error)

func (*AbilityModel) GetAll

func (am *AbilityModel) GetAll() ([]*Ability, error)

func (*AbilityModel) GetByName

func (am *AbilityModel) GetByName(name string) (*Ability, error)

func (*AbilityModel) GetRandomByRarity

func (am *AbilityModel) GetRandomByRarity(rarity string) (*Ability, error)

type ComplexPlayer

type ComplexPlayer struct {
	P Player
	R Role
}

ComplexPlayer is a player with a role

type ComplexRole

type ComplexRole struct {
	ID        int        `db:"id"`
	Name      string     `db:"name"`
	Alignment string     `db:"alignment"`
	Abilities []*Ability `db:"abilities"`
	Passives  []*Passive `db:"passives"`
}

type Game

type Game struct {
	ID          int    `json:"id" db:"id"`
	GameID      string `json:"game_id" db:"game_id"`
	PlayerCount int    `json:"player_count" db:"player_count"`
	CreatedAt   string `json:"created_at" db:"created_at"`
	UpdatedAt   string `json:"updated_at" db:"updated_at"`
}

type GameModel

type GameModel struct {
	*sqlx.DB
}

func (*GameModel) DeleteGame

func (gm *GameModel) DeleteGame(gID string) error

func (*GameModel) GetAll

func (gm *GameModel) GetAll() ([]Game, error)

func (*GameModel) GetByGameID

func (gm *GameModel) GetByGameID(gID string) (*Game, error)

func (*GameModel) GetByID

func (gm *GameModel) GetByID(id int) (*Game, error)

func (*GameModel) InsertGame

func (gm *GameModel) InsertGame(gameID string, playerCount int) (*Game, error)

func (*GameModel) Update

func (gm *GameModel) Update(game *Game) error

func (*GameModel) UpdatePlayerCount

func (gm *GameModel) UpdatePlayerCount(gID string, playerCount int) error

type Item

type Item struct {
	ID          int            `db:"id"`
	Name        string         `db:"name"`
	Description string         `db:"description"`
	Rarity      string         `db:"rarity"`
	Cost        int            `db:"cost"`
	Categories  pq.StringArray `db:"categories"`
}

type ItemModel

type ItemModel struct {
	*sqlx.DB
}

func (*ItemModel) Get

func (m *ItemModel) Get(id int) (*Item, error)

func (*ItemModel) GetAll

func (m *ItemModel) GetAll() ([]*Item, error)

func (*ItemModel) GetByName

func (m *ItemModel) GetByName(name string) (*Item, error)

func (*ItemModel) GetByRarity

func (im *ItemModel) GetByRarity(rarity string) ([]Item, error)

func (*ItemModel) GetRandomByRarity

func (im *ItemModel) GetRandomByRarity(rarity string) (*Item, error)

type Models

type Models struct {
	Games     GameModel
	Players   PlayerModel
	Roles     RoleModel
	Abilities AbilityModel
	Passives  PassiveModel
	Items     ItemModel
	Statuses  StatusModel
}

func NewModels

func NewModels(db *sqlx.DB) *Models

type Passive

type Passive struct {
	ID          int    `db:"id"`
	Name        string `db:"name"`
	Description string `db:"description"`
}

type PassiveModel

type PassiveModel struct {
	*sqlx.DB
}

func (*PassiveModel) Get

func (pm *PassiveModel) Get(id int) (*Passive, error)

func (*PassiveModel) GetAll

func (pm *PassiveModel) GetAll() ([]*Passive, error)

func (*PassiveModel) GetByName

func (pm *PassiveModel) GetByName(name string) (*Passive, error)

type Player

type Player struct {
	ID           int    `db:"id"`
	Name         string `db:"name"`
	GameID       string `db:"game_id"`
	RoleID       int    `db:"role_id"`
	Alive        bool   `db:"alive"`
	Seat         int    `db:"seat"`
	Luck         int    `db:"luck"`
	LuckModifier int    `db:"luck_modifier"`
	CreatedAt    string `db:"created_at"`
	UpdatedAt    string `db:"updated_at"`
}

type PlayerModel

type PlayerModel struct {
	DB *sqlx.DB
}

func (*PlayerModel) Create

func (m *PlayerModel) Create(player *Player) error

func (*PlayerModel) Delete

func (m *PlayerModel) Delete(id int) error

func (*PlayerModel) GetByGameID

func (m *PlayerModel) GetByGameID(gameID string) ([]*Player, error)

func (*PlayerModel) GetByGameIDAndName

func (m *PlayerModel) GetByGameIDAndName(gameID string, name string) (*Player, error)

func (*PlayerModel) GetByID

func (m *PlayerModel) GetByID(id int) (*Player, error)

func (*PlayerModel) GetByName

func (m *PlayerModel) GetByName(name string) (*Player, error)

func (*PlayerModel) GetComplexByGameID

func (m *PlayerModel) GetComplexByGameID(gameID string) ([]*ComplexPlayer, error)

func (*PlayerModel) GetRole

func (m *PlayerModel) GetRole(roleID int) (*Role, error)

func (*PlayerModel) Update

func (m *PlayerModel) Update(player *Player) error

type Role

type Role struct {
	ID         int           `db:"id"`
	Name       string        `db:"name"`
	Alignment  string        `db:"alignment"`
	AbilityIDs pq.Int32Array `db:"ability_ids"`
	PassiveIDs pq.Int32Array `db:"passive_ids"`
}

type RoleModel

type RoleModel struct {
	*sqlx.DB
}

func (*RoleModel) Get

func (rm *RoleModel) Get(id int) (*Role, error)

func (*RoleModel) GetAll

func (rm *RoleModel) GetAll() ([]*Role, error)

func (*RoleModel) GetAllByAbilityID

func (rm *RoleModel) GetAllByAbilityID(id int) ([]*Role, error)

func (*RoleModel) GetAllByPassiveID

func (rm *RoleModel) GetAllByPassiveID(id int) ([]*Role, error)

func (*RoleModel) GetByName

func (rm *RoleModel) GetByName(name string) (*Role, error)

func (*RoleModel) GetComplex

func (rm *RoleModel) GetComplex(id int) (*ComplexRole, error)

func (*RoleModel) GetComplexByName

func (rm *RoleModel) GetComplexByName(name string) (*ComplexRole, error)

func (*RoleModel) GetRandomRole

func (rm *RoleModel) GetRandomRole() (*Role, error)

type Status

type Status struct {
	ID          int    `db:"id"`
	Name        string `db:"name"`
	Description string `db:"description"`
}

type StatusModel

type StatusModel struct {
	*sqlx.DB
}

func (*StatusModel) GetAll

func (m *StatusModel) GetAll() ([]Status, error)

func (*StatusModel) GetByID

func (m *StatusModel) GetByID(id int) (Status, error)

func (*StatusModel) GetByName

func (m *StatusModel) GetByName(name string) (Status, error)

Jump to

Keyboard shortcuts

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