turn

package
v0.0.4-rc Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func NewController

func NewController(service Service) *Controller

func (*Controller) Create

func (tc *Controller) Create(w http.ResponseWriter, r *http.Request) error

func (*Controller) Delete

func (tc *Controller) Delete(w http.ResponseWriter, r *http.Request) error

func (*Controller) Download

func (tc *Controller) Download(w http.ResponseWriter, r *http.Request) error

func (*Controller) FindByID

func (tc *Controller) FindByID(w http.ResponseWriter, r *http.Request) error

func (*Controller) List

func (tc *Controller) List(w http.ResponseWriter, r *http.Request) error

func (*Controller) Update

func (tc *Controller) Update(w http.ResponseWriter, r *http.Request) error

func (*Controller) Upload

func (tc *Controller) Upload(w http.ResponseWriter, r *http.Request) error

type CreateRequest

type CreateRequest struct {
	RoundId   int64      `json:"roundId"`
	Players   []string   `json:"players"`
	StartedAt *time.Time `json:"startedAt,omitempty"`
	ClosedAt  *time.Time `json:"closedAt,omitempty"`
}

func (CreateRequest) Validate

func (CreateRequest) Validate() error

type KeyType

type KeyType int64

func (KeyType) AsInt64

func (k KeyType) AsInt64() int64

func (KeyType) Parse

func (c KeyType) Parse(s string) (KeyType, error)

type Repository

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

func NewRepository

func NewRepository(db *gorm.DB, dataDir string) *Repository

func (*Repository) CreateBulk

func (tr *Repository) CreateBulk(r *CreateRequest) ([]Turn, error)

func (*Repository) Delete

func (tr *Repository) Delete(id int64) error

func (*Repository) FindById

func (tr *Repository) FindById(id int64) (Turn, error)

func (*Repository) FindByRound

func (tr *Repository) FindByRound(id int64) ([]Turn, error)

func (*Repository) GetFile

func (ts *Repository) GetFile(id int64) (string, *os.File, error)

func (*Repository) SaveFile

func (ts *Repository) SaveFile(id int64, r io.Reader) error

func (*Repository) Update

func (tr *Repository) Update(id int64, r *UpdateRequest) (Turn, error)

type Service

type Service interface {
	CreateBulk(request *CreateRequest) ([]Turn, error)
	FindById(id int64) (Turn, error)
	Delete(id int64) error
	Update(id int64, request *UpdateRequest) (Turn, error)
	FindByRound(id int64) ([]Turn, error)
	SaveFile(id int64, r io.Reader) error
	GetFile(id int64) (string, *os.File, error)
}

type Turn

type Turn struct {
	ID        int64      `json:"id"`
	IsWinner  bool       `json:"isWinner"`
	CreatedAt time.Time  `json:"createdAt"`
	UpdatedAt time.Time  `json:"updatedAt"`
	PlayerID  int64      `json:"playerId"`
	Scores    string     `json:"scores"`
	StartedAt *time.Time `json:"startedAt"`
	ClosedAt  *time.Time `json:"closedAt"`
}

type UpdateRequest

type UpdateRequest struct {
	Scores    string     `json:"scores"`
	IsWinner  bool       `json:"isWinner"`
	StartedAt *time.Time `json:"startedAt,omitempty"`
	ClosedAt  *time.Time `json:"closedAt,omitempty"`
}

func (UpdateRequest) Validate

func (UpdateRequest) Validate() error

Jump to

Keyboard shortcuts

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