customers

package
v0.0.0-...-1f03132 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Customer

type Customer struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Cpf       string    `json:"cpf"`
	Birth     string    `json:"birth"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

func NewCustomer

func NewCustomer() *Customer

func (*Customer) GetBirth

func (c *Customer) GetBirth() string

func (*Customer) GetCpf

func (c *Customer) GetCpf() string

func (*Customer) GetID

func (c *Customer) GetID() string

func (*Customer) GetName

func (c *Customer) GetName() string

func (*Customer) IsValid

func (c *Customer) IsValid() (bool, error)

type CustomerInterface

type CustomerInterface interface {
	IsValid() (bool, error)
	GetID() string
	GetName() string
	GetCpf() string
	GetBirth() string
}

type CustomerService

type CustomerService struct {
	Store CustomerStoreInterface
}

func NewCustomerService

func NewCustomerService(store CustomerStoreInterface) *CustomerService

func (*CustomerService) Create

func (c *CustomerService) Create(name, cpf, birth string) (CustomerInterface, error)

func (*CustomerService) FindCustomerByCpf

func (c *CustomerService) FindCustomerByCpf(cpf string) (CustomerInterface, error)

type CustomerServiceInterface

type CustomerServiceInterface interface {
	FindCustomerByCpf(id string) (CustomerInterface, error)
	Create(name, cpf, birth string) (CustomerInterface, error)
}

type CustomerStoreInterface

type CustomerStoreInterface interface {
	FindByCpf(cpf string) (CustomerInterface, error)
	Save(customer CustomerInterface) (CustomerInterface, error)
}

Directories

Path Synopsis
Package mock_customer is a generated GoMock package.
Package mock_customer is a generated GoMock package.

Jump to

Keyboard shortcuts

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