services

package
v0.0.0-...-10eab65 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coffee

type Coffee struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Roast     string    `json:"roast"`
	Image     string    `json:"image"`
	Region    string    `json:"region"`
	Price     float32   `json:"price"`
	GrindUnit int16     `json:"grind_unit"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func (*Coffee) CreateCoffee

func (c *Coffee) CreateCoffee(coffee Coffee) (*Coffee, error)

func (*Coffee) DeleteCoffee

func (c *Coffee) DeleteCoffee(id string) error

func (*Coffee) GetAllCoffees

func (c *Coffee) GetAllCoffees() ([]*Coffee, error)

func (*Coffee) GetCoffeeById

func (c *Coffee) GetCoffeeById(id string) (*Coffee, error)

func (*Coffee) UpdateCoffee

func (c *Coffee) UpdateCoffee(id string, body Coffee) (*Coffee, error)

type JsonResponse

type JsonResponse struct {
	Error   bool        `json:"error"`
	Message string      `json:"message"`
	Data    interface{} `json:"data,omitresponse"`
}

type Models

type Models struct {
	Coffee       Coffee
	JsonResponse JsonResponse
}

func New

func New(dbPool *sql.DB) Models

Jump to

Keyboard shortcuts

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