beer

package
v0.0.0-...-3af8745 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeAle   = 1
	TypeLager = 2
	TypeMalt  = 3
	TypeStout = 4
)
View Source
const (
	StyleAmber = iota + 1
	StyleBlonde
	StyleBrown
	StyleCream
	StyleDark
	StylePale
	StyleStrong
	StyleWheat
	StyleRed
	StyleIPA
	StyleLime
	StylePilsner
	StyleGolden
	StyleFruit
	StyleHoney
)

usando desta forma o compilador vai automaticamente definir os ids sequencialmente

Variables

This section is empty.

Functions

This section is empty.

Types

type Beer

type Beer struct {
	ID    int64     `json:"id"`
	Name  string    `json:"name"`
	Type  BeerType  `json:"type"`
	Style BeerStyle `json:"style"`
}

type BeerStyle

type BeerStyle int

func (BeerStyle) String

func (t BeerStyle) String() string

type BeerType

type BeerType int

func (BeerType) String

func (t BeerType) String() string

type Service

type Service struct {
	DB *sql.DB
}

func NewService

func NewService(db *sql.DB) *Service

NewService função retorna um ponteiro em memória para uma estrutura

func (*Service) Get

func (s *Service) Get(ID int64) (*Beer, error)

func (*Service) GetAll

func (s *Service) GetAll() ([]*Beer, error)

func (*Service) Remove

func (s *Service) Remove(ID int64) error

func (*Service) Store

func (s *Service) Store(b *Beer) error

func (*Service) Update

func (s *Service) Update(b *Beer) error

type UseCase

type UseCase interface {
	GetAll() ([]*Beer, error)
	Get(ID int64) (*Beer, error)
	Store(b *Beer) error
	Update(b *Beer) error
	Remove(ID int64) error
}

UseCase é uma interface de funções que serão usadas no docorrer do projeto.

Jump to

Keyboard shortcuts

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