domain

package
v0.0.0-...-c843baf Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Chat

type Chat struct {
	ID       int64 `gorm:"primary_key;auto_increment:false"`
	Title    sql.NullString
	Username sql.NullString
}

func NewChat

func NewChat(id int64, title string, username string) *Chat

type ChatRepository

type ChatRepository interface {
	Exists(int64) bool
	Get(int64) (Chat, error)
	Store(*Chat) error
	Update(*Chat) error
}

type Game

type Game struct {
	ID          uuid.UUID `gorm:"primary_key;size:36;<-:create"`
	ChatID      int64
	Chat        Chat
	OwnerID     int64
	Owner       User
	Gunslingers []*Gunslinger
	CreatedAt   time.Time
	PlayedAt    sql.NullTime
}

func NewGame

func NewGame(chatID int64, ownerID int64) *Game

func (*Game) IsPlayed

func (g *Game) IsPlayed() bool

func (*Game) MarkAsPlayed

func (g *Game) MarkAsPlayed()

type GameRepository

type GameRepository interface {
	GetLatestForChat(int64) (Game, error)
	GetActiveForChat(int64) (Game, error)
	Store(*Game) error
	Update(*Game) error
	HasActiveOrCreatedTodayInChat(id int64) bool
}

type Gunslinger

type Gunslinger struct {
	ID          uuid.UUID `gorm:"primary_key;size:36;<-:create"`
	GameID      uuid.UUID
	Game        *Game
	PlayerID    int64
	Player      User
	JoinedAt    time.Time
	ShotHimself bool
}

func NewGunslinger

func NewGunslinger(gameID uuid.UUID, playerID int64) *Gunslinger

func (*Gunslinger) MarkAsShotHimself

func (g *Gunslinger) MarkAsShotHimself()

type GunslingerRepository

type GunslingerRepository interface {
	Store(*Gunslinger) error
	Update(*Gunslinger) error
	IsPlayerExistsInGame(userID int64, gameID uuid.UUID) bool
	GetTopShotPlayersInChat(int64) ([]GunslingerTopShotPlayer, error)
	GetTopShopPlayersByYearInChat(chatID int64, year int) ([]GunslingerTopShotPlayer, error)
	CountNumberOfPlayerGamesInChat(userID int64, chatID int64) int64
	CountNumberOfSelfShotsInChat(userID int64, chatID int64) int64
}

type GunslingerTopShotPlayer

type GunslingerTopShotPlayer struct {
	PlayerId int64
	Times    int
}

type User

type User struct {
	ID        int64 `gorm:"primary_key;auto_increment:false"`
	FirstName string
	LastName  string
	Username  string
}

func NewUser

func NewUser(id int64, firstName string, lastName string, username string) *User

func (User) Mention

func (usr User) Mention() string

func (User) Name

func (usr User) Name() string

type UserRepository

type UserRepository interface {
	Exists(int64) bool
	Get(int64) (User, error)
	Store(*User) error
	Update(*User) error
	GetTopShotUsersInChat(chatID int64) ([]*User, error)
	GetTopShotUsersInChatByYear(chatID int64, year int) ([]*User, error)
}

Jump to

Keyboard shortcuts

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