customer

package
v0.0.0-...-2b752c9 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorEmptyUserInput   = errors.New("user input contains empty fields")
	ErrorInvalidBirthdate = errors.New("users birthdate is invalid. It should be in the format of day-month-year")
)

Functions

This section is empty.

Types

type Customer

type Customer struct {
	ID        entity.ID
	FirstName string
	LastName  string
	Gender    string
	Birthdate string
	// contains filtered or unexported fields
}

Customer entity which represents unique customers

func (*Customer) GetCLastUpdateTimestamp

func (c *Customer) GetCLastUpdateTimestamp() time.Time

func (*Customer) GetCreationTimestamp

func (c *Customer) GetCreationTimestamp() time.Time

type Manager

type Manager interface {
	Create(ctx context.Context, c Customer) (entity.ID, error)
	Update(ctx context.Context, c Customer) error
	Get(ctx context.Context, id entity.ID) (Customer, error)
}

func NewManager

func NewManager(r repository) Manager

type MySqlRepository

type MySqlRepository struct {
	// contains filtered or unexported fields
}

func NewMySqlRepository

func NewMySqlRepository(client *sql.DB) (*MySqlRepository, error)

func (MySqlRepository) Create

func (m MySqlRepository) Create(ctx context.Context, c Customer) error

func (MySqlRepository) Get

func (MySqlRepository) Update

func (m MySqlRepository) Update(ctx context.Context, c Customer) error

Jump to

Keyboard shortcuts

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