account

package
v0.0.0-...-e55fb6d Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("account not found")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	ID        ulid.ULID
	Name      string
	Document  string
	Balance   decimal.Decimal
	CreatedAt time.Time
	UpdateAt  time.Time
}

type Clock

type Clock func() time.Time

type ErrValidation

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

func (*ErrValidation) Error

func (e *ErrValidation) Error() string

func (*ErrValidation) Errors

func (e *ErrValidation) Errors() []string

func (*ErrValidation) Unwrap

func (e *ErrValidation) Unwrap() []error

type IDGen

type IDGen func() ulid.ULID

type NewAccount

type NewAccount struct {
	Name            string
	Document        string
	StartingBalance decimal.Decimal
}

type Service

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

func NewService

func NewService(s Storage, id IDGen, clock Clock) *Service

func (*Service) New

func (s *Service) New(ctx context.Context, a NewAccount) (ulid.ULID, error)

func (*Service) Retrieve

func (s *Service) Retrieve(ctx context.Context, id string) (*Account, error)

type Storage

type Storage interface {
	GetAccount(ctx context.Context, id string) (*Account, error)
	CreateAccount(ctx context.Context, acc Account) error
}

Jump to

Keyboard shortcuts

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