entities

package
v0.0.0-...-5927a11 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DURATION = 15
	ISSUER   = "JWT"
)

Variables

View Source
var (
	ErrInvalidAmount             = errors.New("the amount must be greater than zero")
	ErrInvalidTransfer           = errors.New("insufficient funds")
	ErrInvalidDestinationAccount = errors.New("accounts must be different")
)
View Source
var (
	ErrInvalidName = errors.New("invalid name")
)

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountID string     `json:"accountID"`
	Name      string     `json:"name"`
	CPF       vos.CPF    `json:"cpf"`
	Secret    vos.Secret `json:"secret"`
	Balance   int        `json:"balance"`
	CreatedAt time.Time  `json:"createdAt"`
}

func NewCreateAccount

func NewCreateAccount(name string, secret vos.Secret, cpf vos.CPF) (Account, error)

type Login

type Login struct {
	CPF    vos.CPF
	Secret vos.Secret
}

type Token

type Token struct {
	ID        string
	Name      string
	Subject   string
	Issuer    string
	IssuedAt  time.Time
	ExpiredAt time.Time
}

func NewCreateToken

func NewCreateToken(username, subject string) Token

type Transfer

type Transfer struct {
	TransferID           string
	AccountOriginID      string
	AccountDestinationID string
	Amount               int
	CreatedAt            time.Time
}

func NewTransfer

func NewTransfer(originAccount, destinationAccount Account, amount int) (Transfer, error)

Jump to

Keyboard shortcuts

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