entities

package
v0.0.0-...-80b4807 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package entities contains global level objects accessible by other packages of the application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ID       int             `json:"-"`
	Name     string          `json:"name"`
	Balance  decimal.Decimal `json:"balance"`
	Currency Currency        `json:"currency"`
}

Account represents a user account in the system.

func (Account) MayGoBelowZero

func (a Account) MayGoBelowZero() bool

type Currency

type Currency string

Currency is a string representation of real-word currency.

const USD Currency = "usd"

type Direction

type Direction string

Direction is a representation of money movement direction

const (
	Incoming Direction = "incoming"
	Outgoing Direction = "outgoing"
)

type Payment

type Payment struct {
	Account      Account
	Counterparty Account
	Transaction  Transaction
	Direction    Direction
	Amount       decimal.Decimal
	Currency     Currency
}

Payment represents a money move between two accounts in a single direction (either incoming or outgoing). Each payment has a corresponding opposite payment. Both such payments are linked by a single Transaction.

type Transaction

type Transaction struct {
	ID        int       `json:"-"`
	CreatedAt time.Time `json:"created_at"`
}

Transaction is an object linking two related and opposite payments.

Jump to

Keyboard shortcuts

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