Documentation ¶
Index ¶
- type AccountIdType
- type Controller
- func (gc *Controller) Create(w http.ResponseWriter, r *http.Request) error
- func (gc *Controller) Delete(w http.ResponseWriter, r *http.Request) error
- func (gc *Controller) FindByID(w http.ResponseWriter, r *http.Request) error
- func (gc *Controller) List(w http.ResponseWriter, r *http.Request) error
- func (gc *Controller) Update(w http.ResponseWriter, r *http.Request) error
- type CreateRequest
- type Game
- type IntervalType
- type KeyType
- type Player
- type Repository
- func (gs *Repository) Create(r *CreateRequest) (Game, error)
- func (gs *Repository) Delete(id int64) error
- func (gs *Repository) FindById(id int64) (Game, error)
- func (gs *Repository) FindByInterval(accountId string, i api.IntervalParams, p api.PaginationParams) ([]Game, int64, error)
- func (gs *Repository) Update(id int64, r *UpdateRequest) (Game, error)
- type Service
- type UpdateRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountIdType ¶
type AccountIdType string
func (AccountIdType) AsString ¶
func (a AccountIdType) AsString() string
func (AccountIdType) Parse ¶
func (AccountIdType) Parse(s string) (AccountIdType, error)
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func NewController ¶
func NewController(gs Service) *Controller
func (*Controller) Create ¶
func (gc *Controller) Create(w http.ResponseWriter, r *http.Request) error
func (*Controller) Delete ¶
func (gc *Controller) Delete(w http.ResponseWriter, r *http.Request) error
func (*Controller) FindByID ¶
func (gc *Controller) FindByID(w http.ResponseWriter, r *http.Request) error
func (*Controller) List ¶
func (gc *Controller) List(w http.ResponseWriter, r *http.Request) error
func (*Controller) Update ¶
func (gc *Controller) Update(w http.ResponseWriter, r *http.Request) error
type CreateRequest ¶
type CreateRequest struct { Name string `json:"name"` Players []string `json:"players"` Description string `json:"description"` Difficulty string `json:"difficulty"` StartedAt *time.Time `json:"startedAt,omitempty"` ClosedAt *time.Time `json:"closedAt,omitempty"` }
func (CreateRequest) Validate ¶
func (CreateRequest) Validate() error
type Game ¶
type Game struct { ID int64 `json:"id"` CurrentRound int `json:"currentRound"` Description string `json:"description"` Difficulty string `json:"difficulty"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` StartedAt *time.Time `json:"startedAt"` ClosedAt *time.Time `json:"closedAt"` Name string `json:"name"` Players []Player `json:"players,omitempty"` }
type IntervalType ¶
func (IntervalType) AsTime ¶
func (k IntervalType) AsTime() time.Time
func (IntervalType) Parse ¶
func (IntervalType) Parse(s string) (IntervalType, error)
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(db *gorm.DB) *Repository
func (*Repository) Create ¶
func (gs *Repository) Create(r *CreateRequest) (Game, error)
func (*Repository) Delete ¶
func (gs *Repository) Delete(id int64) error
func (*Repository) FindByInterval ¶
func (gs *Repository) FindByInterval(accountId string, i api.IntervalParams, p api.PaginationParams) ([]Game, int64, error)
func (*Repository) Update ¶
func (gs *Repository) Update(id int64, r *UpdateRequest) (Game, error)
type Service ¶
type Service interface { Create(request *CreateRequest) (Game, error) FindById(id int64) (Game, error) Delete(id int64) error Update(id int64, ug *UpdateRequest) (Game, error) FindByInterval(accountId string, i api.IntervalParams, p api.PaginationParams) ([]Game, int64, error) }
type UpdateRequest ¶
type UpdateRequest struct { CurrentRound int `json:"currentRound"` Name string `json:"name"` Description string `json:"description"` StartedAt *time.Time `json:"startedAt,omitempty"` ClosedAt *time.Time `json:"closedAt,omitempty"` }
func (UpdateRequest) Validate ¶
func (UpdateRequest) Validate() error
Click to show internal directories.
Click to hide internal directories.