listing

package
v0.0.0-...-926ba8e Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Good

type Good struct {
	Name         string    `json:"name"`
	Manufactured time.Time `json:"manufactured"`
	ExpDate      time.Time `jsnon:"expdate"`
	ExpOpen      int       `json:"expopen"`
}

Good struct holds the data of an item type: ID -- autogenarated Name -- Goods name Manufactured -- Goods manufactured date ExpDate -- Goods validity ExpOpen -- Goods validity if it is opened

type Item

type Item struct {
	ID      int `json:"id"`
	Created time.Time
	Good
	IsOpen  bool      `json:"isopen"`
	Opened  time.Time `json:"opened,omitempty"`
	IsValid bool      `json:"isvalid"`
}

Item struct holds the data of the instance of the goods: ID -- autogenerated Type -- the type of product IsOpen -- True if the product is opened Opened -- The date when it was opeened IsValid -- Is the item still in validity or has expired

type Repository

type Repository interface {
	// GetGoods returns all the Items.
	ListItems() ([]Item, error)
}

Repository provides access to the items storage.

type Service

type Service interface {
	ListItems() ([]Item, error)
}

Service provides beer and review listing operations.

func NewService

func NewService(r Repository) Service

NewService creates a listing service with the necessary dependencies

Jump to

Keyboard shortcuts

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