Documentation ¶
Index ¶
- func RoasterToSQL(roaster *Roaster) *sql.Roaster
- type Roaster
- type RoasterService
- func (s *RoasterService) CreateRoasterByName(ctx context.Context, name string) (*Roaster, error)
- func (s *RoasterService) DeleteRoasterById(ctx context.Context, id int) error
- func (s *RoasterService) GetAllRoasters(ctx context.Context) ([]Roaster, error)
- func (s *RoasterService) GetRoasterById(ctx context.Context, id int) (*Roaster, error)
- func (s *RoasterService) Ping(ctx context.Context) error
- func (s *RoasterService) UpdateRoasterById(ctx context.Context, id int, roaster *Roaster) (*Roaster, error)
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RoasterToSQL ¶
RoasterToSQL converts a Roaster object to its corresponding SQL representation. If the input roaster is nil, it returns nil.
Types ¶
type Roaster ¶
type Roaster struct { // The id for the roaster Id int `json:"id"` // The name for the roaster Name string `json:"name"` // The creation date of the roaster CreatedAt *time.Time `json:"created_at"` // The last update date of the roaster UpdatedAt *time.Time `json:"updated_at"` }
Roaster
Represents a roaster for this application ¶
A roaster is the professional who roasts coffee beans.
swagger:model
func SQLToRoaster ¶
SQLToRoaster converts a *sql.Roaster object to a *Roaster object. If the input roaster is nil, it returns nil.
type RoasterService ¶
type RoasterService struct {
// contains filtered or unexported fields
}
func New ¶
func New(repo repository.RoasterRepository) *RoasterService
func (*RoasterService) CreateRoasterByName ¶
func (*RoasterService) DeleteRoasterById ¶
func (s *RoasterService) DeleteRoasterById(ctx context.Context, id int) error
func (*RoasterService) GetAllRoasters ¶
func (s *RoasterService) GetAllRoasters(ctx context.Context) ([]Roaster, error)
func (*RoasterService) GetRoasterById ¶
func (*RoasterService) UpdateRoasterById ¶
type Service ¶
type Service interface { CreateRoasterByName(ctx context.Context, name string) (*Roaster, error) GetRoasterById(ctx context.Context, id int) (*Roaster, error) GetAllRoasters(ctx context.Context) ([]Roaster, error) UpdateRoasterById(ctx context.Context, id int, roaster *Roaster) (*Roaster, error) DeleteRoasterById(ctx context.Context, id int) error Ping(ctx context.Context) error }
Click to show internal directories.
Click to hide internal directories.