vos

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountBalance

type AccountBalance struct {
	Account        AccountPath
	CurrentVersion Version
	TotalCredit    int
	TotalDebit     int
}

func NewAccountBalance

func NewAccountBalance(account AccountPath, version Version, totalCredit, totalDebit int) AccountBalance

func (AccountBalance) Balance

func (a AccountBalance) Balance() int

type AccountConfig added in v0.3.0

type AccountConfig struct {
	MinimumDepth   int
	MaximumDepth   int
	DepthConfigs   map[int]DepthConfig
	DepthSeparator string
}

type AccountPath

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

AccountPath can be as deep as needed, limited by AccountConfig MinimumDepth and MaximumDepth. None of the values can be ” (empty string), more than 255 characters or characteres other than alphanumeric and underscore (_). Depth restrictions can be applied by using DepthConfig. The default configuration for example:

  • the first depth is called class
  • it can only be one of the following:
  • liability
  • assets
  • income
  • expense
  • equity
  • account need to have a depth of at least 3
  • there are no upper limits
  • '.' must be used as a separator.

Some examples:

  • assets.account.treasury
  • liability.available.96a131a8_c4ac_495e_8971_fcecdbdd003a
  • liability.available.96a131a8_c4ac_495e_8971_fcecdbdd003a.some_detail
  • liability.clients.available.96a131a8_c4ac_495e_8971_fcecdbdd003a.detail1.detail2

func NewAccountPath

func NewAccountPath(path string) (AccountPath, error)

func (AccountPath) Name

func (a AccountPath) Name() string

type AccountQuery added in v0.3.0

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

AccountQuery can have depth between 0 (empty) and n in her structure: "class.subgroup.account...". And, as AccountPath, AccountQuery respects the depth configurations.

Some examples:

  • ""
  • "liability"
  • "liability.clients"
  • "liability.clients.available"

func NewAccountQuery added in v0.3.0

func NewAccountQuery(query string) (AccountQuery, error)

func (AccountQuery) Value added in v0.3.0

func (q AccountQuery) Value() string

type DepthConfig added in v0.3.0

type DepthConfig struct {
	Restrictions map[string]struct{}
	Name         string
}

type EntryHistory added in v0.2.0

type EntryHistory struct {
	Amount    int
	Operation OperationType
	CreatedAt time.Time
}

func NewEntryHistory added in v0.2.0

func NewEntryHistory(operation OperationType, amount int, createdAt time.Time) (*EntryHistory, error)

type OperationType

type OperationType int8
const (
	InvalidOperation OperationType = iota
	CreditOperation
	DebitOperation
)

func OperationTypeFromString

func OperationTypeFromString(opType string) OperationType

func (OperationType) String

func (ot OperationType) String() string

type QueryBalance added in v0.4.0

type QueryBalance struct {
	Query   AccountQuery
	Balance int
}

func NewQueryBalance added in v0.4.0

func NewQueryBalance(query AccountQuery, balance int) QueryBalance

type Statement

type Statement struct {
	Account   string
	Operation OperationType
	Amount    int
}

func NewStatement

func NewStatement(account string, operation OperationType, amount int) (*Statement, error)

type Version

type Version int64
const (
	IgnoreAccountVersion Version = -1
	NextAccountVersion   Version = 0
)

func (Version) AsInt64 added in v0.3.0

func (v Version) AsInt64() int64

Jump to

Keyboard shortcuts

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