gamestrg

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	SQLClient *sqlx.DB `validate:"nonnil"`
}

func (Config) Validate

func (c Config) Validate() error

type GameRow

type GameRow struct {
	ID         string             `db:"id"`
	PlayerName string             `db:"player_name"`
	CreatedAt  int64              `db:"created_at"`
	BattleWon  int                `db:"battle_won"`
	Scenario   entity.Scenario    `db:"scenario"`
	Partner    *shared.MonsterRow `db:"partner"`
}

func NewGameRow

func NewGameRow(game *entity.Game) *GameRow

func (*GameRow) ToGame

func (r *GameRow) ToGame() *entity.Game

type Storage

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

func New

func New(cfg Config) (*Storage, error)

func (*Storage) GetGame

func (s *Storage) GetGame(ctx context.Context, gameID string) (*entity.Game, error)

func (*Storage) SaveGame

func (s *Storage) SaveGame(ctx context.Context, game entity.Game) error

Jump to

Keyboard shortcuts

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