vo

package
v0.0.0-...-ac81adf Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTypeUser = errors.New("invalid type user")

	ErrNotAllowedTypeUser = errors.New("not allowed user type")
)
View Source
var (
	ErrInvalidCNPJ = errors.New("invalid cnpj")
)
View Source
var (
	ErrInvalidCPF = errors.New("invalid cpf")
)
View Source
var (
	ErrInvalidCurrency = errors.New("invalid currency")
)
View Source
var (
	ErrInvalidDocument = errors.New("invalid document")
)
View Source
var (
	ErrInvalidEmail = errors.New("invalid email")
)
View Source
var (
	ErrInvalidTypeDocument = errors.New("invalid type document")
)
View Source
var (
	ErrInvalidUuid = errors.New("invalid uuid")
)

Functions

This section is empty.

Types

type Amount

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

Amount structure

func NewAmount

func NewAmount(value int64) (Amount, error)

NewAmount create new Amount

func NewAmountTest

func NewAmountTest(value int64) Amount

NewAmountTest create new Amount for testing

func (Amount) Equals

func (a Amount) Equals(value Value) bool

Equals checks that two Amount are the same

func (Amount) String

func (a Amount) String() string

String returns string representation of the Amount

func (Amount) Value

func (a Amount) Value() int64

Value return value Amount

type Cnpj

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

Cnpj structure

func NewCNPJ

func NewCNPJ(value string) (Cnpj, error)

NewCNPJ create new Cnpj

func (Cnpj) Equals

func (c Cnpj) Equals(value Value) bool

Equals checks that two Cnpj are the same

func (Cnpj) String

func (c Cnpj) String() string

String returns string representation of the Cnpj

func (Cnpj) Value

func (c Cnpj) Value() string

Value return value Cnpj

type Cpf

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

Cpf structure

func NewCPF

func NewCPF(value string) (Cpf, error)

NewCPF create new Cpf

func (Cpf) Equals

func (c Cpf) Equals(value Value) bool

Equals checks that two Cpf are the same

func (Cpf) String

func (c Cpf) String() string

String returns string representation of the Cpf

func (Cpf) Value

func (c Cpf) Value() string

Value return value Cpf

type Currency

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

Currency structure

func NewCurrency

func NewCurrency(value string) (Currency, error)

NewCurrency create new Currency

func (Currency) Equals

func (c Currency) Equals(value Value) bool

Equals checks that two Currency are the same

func (Currency) String

func (c Currency) String() string

String returns string representation of the Currency

func (Currency) Value

func (c Currency) Value() TypeCurrency

Value return value Currency

type Document

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

Document structure

func NewDocument

func NewDocument(typeDoc TypeDocument, value string) (Document, error)

NewDocument create new Document

func NewDocumentTest

func NewDocumentTest(t TypeDocument, value string) Document

NewDocumentTest create new Document for testing

func (Document) Equals

func (d Document) Equals(value Value) bool

Equals checks that two Document are the same

func (Document) Type

func (d Document) Type() TypeDocument

Type return type Document

func (Document) Value

func (d Document) Value() string

Value return value Document

type Email

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

Email structure

func NewEmail

func NewEmail(value string) (Email, error)

NewEmail create new Email

func NewEmailTest

func NewEmailTest(e string) Email

NewEmailTest create new Email for test

func (Email) Equals

func (e Email) Equals(value Value) bool

Equals checks that two Email are the same

func (Email) String

func (e Email) String() string

String returns string representation of the Email

func (Email) Value

func (e Email) Value() string

Value return value Email

type FullName

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

FullName structure

func NewFullName

func NewFullName(value string) FullName

NewFullName create new FullName

func (FullName) Equals

func (p FullName) Equals(value Value) bool

Equals checks that two FullName are the same

func (FullName) Value

func (p FullName) Value() string

Value return value FullName

type Money

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

Money structure

func NewMoney

func NewMoney(currency Currency, amount Amount) Money

NewMoney create new Money

func NewMoneyBRL

func NewMoneyBRL(amount Amount) Money

NewMoneyBRL create new Money with currency BRL

func (Money) Add

func (m Money) Add(amount Amount) Money

Add value in Amount

func (Money) Amount

func (m Money) Amount() Amount

Amount return value Amount

func (Money) Currency

func (m Money) Currency() Currency

Currency return value currency

func (Money) Equals

func (m Money) Equals(value Value) bool

Equals checks that two Money are the same

func (Money) Sub

func (m Money) Sub(amount Amount) Money

Sub value in Amount

type Password

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

Password structure

func NewPassword

func NewPassword(value string) Password

NewPassword create new Password

func (Password) Equals

func (p Password) Equals(value Value) bool

Equals checks that two Password are the same

func (Password) Value

func (p Password) Value() string

Value return value Password

type Roles

type Roles struct {
	CanTransfer bool
}

type TypeCurrency

type TypeCurrency string

TypeCurrency define currency types

const (
	// Currency types
	BRL TypeCurrency = "BRL"
	USD TypeCurrency = "USD"
)

func (TypeCurrency) String

func (tc TypeCurrency) String() string

type TypeDocument

type TypeDocument string

TypeDocument define document types

const (
	// Document types
	CPF  TypeDocument = "CPF"
	CNPJ TypeDocument = "CNPJ"
)

func (TypeDocument) String

func (t TypeDocument) String() string

String returns string representation of the TypeDocument

type TypeUser

type TypeUser string

TypeUser define user types

const (
	COMMON   TypeUser = "COMMON"
	MERCHANT TypeUser = "MERCHANT"
)

func NewTypeUser

func NewTypeUser(value string) (TypeUser, error)

func (TypeUser) String

func (t TypeUser) String() string

String returns string representation of the TypeUser

func (TypeUser) ToUpper

func (t TypeUser) ToUpper() TypeUser

ToUpper

type Uuid

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

Uuid structure

func NewUuid

func NewUuid(value string) (Uuid, error)

NewUuid create new Uuid

func NewUuidStaticTest

func NewUuidStaticTest() Uuid

NewUuidStaticTest create new Uuid static

func (Uuid) Equals

func (e Uuid) Equals(value Value) bool

Equals checks that two Uuid are the same

func (Uuid) String

func (e Uuid) String() string

String returns string representation of the Uuid

func (Uuid) Value

func (e Uuid) Value() string

Value return value Uuid

type Value

type Value interface {
	//fmt.Stringer
	Equals(value Value) bool
}

Value object, includes method String() from fmt.Stringer

type Wallet

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

Wallet structure

func NewWallet

func NewWallet(money Money) *Wallet

Currency return value currency

func (*Wallet) Add

func (w *Wallet) Add(amount Amount) Money

Add value in money value amount

func (*Wallet) Equals

func (w *Wallet) Equals(value Value) bool

Equals checks that two Wallet are the same

func (Wallet) Money

func (w Wallet) Money() Money

Money return value money

func (*Wallet) NewMoney

func (w *Wallet) NewMoney(money Money)

func (*Wallet) Sub

func (w *Wallet) Sub(amount Amount) Money

Sub value in money value amount

Jump to

Keyboard shortcuts

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