model

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BetRequestToProto

func BetRequestToProto(bet *Bet) *gen.CreateBetRequest

func BetsToProto

func BetsToProto(bets []*Bet) []*gen.Bet

func EventRequestToProto

func EventRequestToProto(req *EventRequest) *gen.CreateEventRequest

func EventsToProto

func EventsToProto(events []*Event) []*gen.Event

func FightResultToProto

func FightResultToProto(req *FightResultRequest) *gen.FightResultRequest

func FightsToProto

func FightsToProto(fights []Fight) []*gen.Fight

func HealthStatusToProto

func HealthStatusToProto(status *HealthStatus) *gen.HealthResponse

HealthStatusToProto converts HealthStatus model to gen.HealthResponse

Types

type Bet

type Bet struct {
	BetId     int32 `json:"bet_id"`
	FightId   int32 `json:"fight_id"`
	UserId    int32 `json:"user_id"`
	FighterId int32 `json:"fighter_id"`
}

Bet represents users bet properties

func BetRequestFromProto

func BetRequestFromProto(p *gen.CreateBetRequest) *Bet

func BetsFromProto

func BetsFromProto(p []*gen.Bet) []*Bet

type BetsResponse

type BetsResponse struct {
	Count int32  `json:"count"`
	Bets  []*Bet `json:"bets"`
}

type Event

type Event struct {
	EventId int32   `json:"event_id"`
	Name    string  `json:"name"`
	Fights  []Fight `json:"fights"`
	IsDone  bool    `json:"is_done"`
}

Event represents a event struct with []Fights

func EventsFromProto

func EventsFromProto(p []*gen.Event) []*Event

type EventRequest

type EventRequest struct {
	Name   string `json:"name"`
	Fights []Fight
}

EventRequest represents a request for event with name and slice of fights

func EventRequestFromProto

func EventRequestFromProto(p *gen.CreateEventRequest) *EventRequest

type EventsResponse

type EventsResponse struct {
	Count  int32    `json:"count"`
	Events []*Event `json:"events"`
}

EventResponse represents a event response with []Event

type Fight

type Fight struct {
	FightId       int32        `json:"fight_id"`
	EventId       int32        `json:"event_id"`
	FighterRedId  int32        `json:"fighter_red_id"`
	FighterBlueId int32        `json:"fighter_blue_id"`
	IsDone        bool         `json:"is_done"`
	IsDraw        bool         `json:"is_draw"`
	IsCanceled    bool         `json:"is_canceled"`
	NotContest    bool         `json:"not_contest"`
	WinnerId      int32        `json:"winner_id,omitempty"`
	CreatedAt     time.Time    `json:"created_at"`
	FightDate     sql.NullTime `json:"fight_date"`
}

Fight is a structure with fight information and fighters ids

func FightsFromProto

func FightsFromProto(p []*gen.Fight) []Fight

type FightResponse

type FightResponse struct {
	FightId     int32                 `json:"fight_id"`
	EventId     int32                 `json:"event_id,omitempty"`
	FighterRed  fightersmodel.Fighter `json:"fighter_red"`
	FighterBlue fightersmodel.Fighter `json:"fighter_blue"`
	IsDone      bool                  `json:"is_done"`
	IsCanceled  bool                  `json:"is_canceled"`
	NotContest  bool                  `json:"not_contest"`
	Result      int32                 `json:"result"`
	CreatedAt   int64                 `json:"created_at"`
	FightDate   int                   `json:"fight_date,omitempty"`
}

Fight is a structure with information about the fight and contains the structures of the participating fighters

type FightResultRequest

type FightResultRequest struct {
	FightId    int32  `json:"fight_id"`
	WinnerId   int32  `json:"winner_id"`
	IsCanceled bool   `json:"is_canceled"`
	IsDraw     bool   `json:"is_draw"`
	NotContest bool   `json:"not_contest"`
	Method     string `json:"method"`
	Round      int    `json:"round"`
}

FightResultRequest represents a request for fight result with fight id, winner id and not contest flag.

func FightResultFromProto

func FightResultFromProto(p *gen.FightResultRequest) *FightResultRequest

type FullEventResponse

type FullEventResponse struct {
	EventId int32           `json:"event_id"`
	Name    string          `json:"name"`
	Fights  []FightResponse `json:"fights"`
	IsDone  bool            `json:"is_done"`
}

EventResponse represents a event response with []FightsResponse

type HealthStatus

type HealthStatus struct {
	AppDevVersion string `json:"app_dev_version"`
	AppName       string `json:"app_name"`
	AppRunDate    int64  `json:"app_run_date"`
	AppTimeAlive  int64  `json:"app_time_alive"`
	Healthy       bool   `json:"healthy"`
	Message       string `json:"message"`
	Timestamp     string `json:"timestamp"`
}

Jump to

Keyboard shortcuts

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