menu

package
v0.0.0-...-bc6e940 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package menu provides the use case for menu

Package menu provides the use case for menu

Package menu provides the use case for menu

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NewMenu

type NewMenu struct {
	Name        string  `json:"name" example:"Paracetamol"`
	Description string  `json:"description" example:"Some Description"`
	Price       float64 `json:"price" example:"200.50"`
}

NewMenu is a struct that contains the data for a new menu

type PaginationResultMenu

type PaginationResultMenu struct {
	Data       *[]domainMenu.Menu
	Total      int64
	Limit      int64
	Current    int64
	NextCursor uint
	PrevCursor uint
	NumPages   int64
}

PaginationResultMenu is a struct that contains the pagination result for menu

type Service

type Service struct {
	MenuRepository repository.Menus
}

Service is a struct that contains the repository implementation for menu use case

func (*Service) Create

func (s *Service) Create(ctx context.Context, menu *NewMenu) (*menuDomain.Menu, error)

Create is a function that creates a menu

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id int64) error

Delete is a function that deletes a menu by id

func (*Service) GetAll

func (s *Service) GetAll(ctx context.Context, page int64, limit int64) (*PaginationResultMenu, error)

GetAll is a function that returns all menus

func (*Service) GetByID

func (s *Service) GetByID(ctx context.Context, id int64) (*menuDomain.Menu, error)

GetByID is a function that returns a menu by id

func (*Service) GetByTopCount

func (s *Service) GetByTopCount(ctx context.Context, count int) ([]menuDomain.Menu, error)

GetByTopCount is a function that returns a menu by top counts

Jump to

Keyboard shortcuts

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