round

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: 8 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(rs Service) *Controller

func (*Controller) Create

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

func (*Controller) Delete

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

func (*Controller) FindByID

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

func (*Controller) List

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

func (*Controller) Update

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

type CreateRequest

type CreateRequest struct {
	GameId      int64      `json:"gameId"`
	TestClassId string     `json:"testClassId"`
	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) *Repository

func (*Repository) Create

func (rs *Repository) Create(r *CreateRequest) (Round, error)

func (*Repository) Delete

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

func (*Repository) FindByGame

func (rs *Repository) FindByGame(id int64) ([]Round, error)

func (*Repository) FindById

func (rs *Repository) FindById(id int64) (Round, error)

func (*Repository) Update

func (rs *Repository) Update(id int64, r *UpdateRequest) (Round, error)

type Round

type Round struct {
	ID          int64      `json:"id"`
	Order       int        `json:"order"`
	TestClassId string     `json:"testClassId"`
	CreatedAt   time.Time  `json:"createdAt"`
	UpdatedAt   time.Time  `json:"updatedAt"`
	StartedAt   *time.Time `json:"startedAt"`
	ClosedAt    *time.Time `json:"closedAt"`
}

type Service

type Service interface {
	Create(request *CreateRequest) (Round, error)
	FindById(id int64) (Round, error)
	Delete(id int64) error
	Update(id int64, request *UpdateRequest) (Round, error)
	FindByGame(id int64) ([]Round, error)
}

type UpdateRequest

type UpdateRequest struct {
	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