robot

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: 10 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) CreateBulk

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

func (*Controller) Delete

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

func (*Controller) FindByFilter

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

type CreateRequest

type CreateRequest struct {
	Robots []CreateSingleRequest `json:"robots"`
}

func (CreateRequest) Validate

func (robots CreateRequest) Validate() error

type CreateSingleRequest

type CreateSingleRequest struct {
	TestClassId string    `json:"testClassId"`
	Scores      string    `json:"scores"`
	Difficulty  string    `json:"difficulty"`
	Type        RobotType `json:"type"`
}

func (CreateSingleRequest) Validate

func (r CreateSingleRequest) Validate() error

type CustomString

type CustomString string

func (CustomString) AsString

func (s CustomString) AsString() string

func (CustomString) Parse

func (CustomString) Parse(s string) (CustomString, error)

CustomString is a dummy type that implements Convertable and Validable interfaces

func (CustomString) Validate

func (CustomString) Validate() error

type Robot

type Robot struct {
	ID          int64     `json:"id"`
	TestClassId string    `json:"testClassId"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
	Difficulty  string    `json:"difficulty"`
	Type        RobotType `json:"type"`
	Scores      string    `json:"scores"`
}

type RobotStorage

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

func NewRobotStorage

func NewRobotStorage(db *gorm.DB) *RobotStorage

func (*RobotStorage) CreateBulk

func (rs *RobotStorage) CreateBulk(r *CreateRequest) (int, error)

func (*RobotStorage) DeleteByTestClass

func (rs *RobotStorage) DeleteByTestClass(testClassId string) error

func (*RobotStorage) FindByFilter

func (gs *RobotStorage) FindByFilter(testClassId string, difficulty string, t RobotType) (Robot, error)

type RobotType

type RobotType int8

func (RobotType) AsInt8

func (rb RobotType) AsInt8() int8

func (RobotType) MarshalJSON

func (rb RobotType) MarshalJSON() ([]byte, error)

func (RobotType) Parse

func (rb RobotType) Parse(s string) (RobotType, error)

func (RobotType) String

func (rb RobotType) String() string

func (*RobotType) UnmarshalJSON

func (rb *RobotType) UnmarshalJSON(data []byte) error

type Service

type Service interface {
	CreateBulk(request *CreateRequest) (int, error)
	FindByFilter(testClassId string, difficulty string, t RobotType) (Robot, error)
	DeleteByTestClass(testClassId string) error
}

type UpdateRequest

type UpdateRequest struct {
	Scores     string `json:"scores"`
	Difficulty string `json:"difficulty"`
}

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