db

package
v0.0.0-...-e985f82 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUncivIDAlreadyBound = errors.New("Unciv ID already connected to a Telegram ID")
	ErrGameNotFound        = errors.New("game not found in database")
)

Functions

This section is empty.

Types

type Database

type Database interface {
	GetGameByID(string, bool) (Game, error)
	GetGameByChatID(int64, bool) (Game, error)
	GetPlayerByUncivID(string, bool) (Player, error)
	AddGame(Game) error
	AddPlayer(Player) error
	ConnectTelegram(string, int64) error
}

func NewMemoryDB

func NewMemoryDB(automigrate bool) (Database, error)

func NewSqliteDB

func NewSqliteDB(filename string, automigrate bool) (Database, error)

type Game

type Game struct {
	GameID  string `gorm:"primaryKey"`
	ChatID  int64
	Players []Player `gorm:"many2many:game_players;"`
	// contains filtered or unexported fields
}

type Player

type Player struct {
	UncivID    string `gorm:"primaryKey"`
	TelegramID int64
	Games      []Game `gorm:"many2many:game_players;"`
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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