model

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventPromise represents promise prefix
	EventPromise = "0"
	// EventCommit represents commit prefix
	EventCommit = "1"
	// EventRollback represents rollback prefix
	EventRollback = "2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	AccountName    string `json:"accountNumber"`
	Currency       string `json:"currency"`
	IsBalanceCheck bool   `json:"isBalanceCheck"`
	Balance        *money.Dec
	Promised       *money.Dec
	PromiseBuffer  TransactionSet
	Version        int
}

Account represents metadata of account entity

func NewAccount

func NewAccount(name string) Account

NewAccount returns new Account

func (Account) Copy

func (s Account) Copy() Account

Copy returns copy of Account

func (*Account) Deserialise

func (entity *Account) Deserialise(data []byte)

Hydrate deserializes Account entity from persistent data

func (*Account) Serialise

func (entity *Account) Serialise() []byte

Serialise Account entity to persistable data

type Commit

type Commit struct {
	Transaction string
	Amount      *money.Dec
	Currency    string
}

Commit is inbound request for transaction commit

type Committed

type Committed struct {
	IDTransaction string
}

Committed is reply message that transaction is committed

type CreateAccount

type CreateAccount struct {
	AccountName    string
	Currency       string
	IsBalanceCheck bool
}

CreateAccount is inbound request for creation of new account

type GetAccountState

type GetAccountState struct {
}

GetAccountState is inbound request for balance of account

type Promise

type Promise struct {
	Transaction string
	Amount      *money.Dec
	Currency    string
}

Promise is inbound request for transaction promise

type Rollback

type Rollback struct {
	Transaction string
	Amount      *money.Dec
	Currency    string
}

Rollback is inbound request for transaction rollback

type Rollbacked

type Rollbacked struct {
	IDTransaction string
}

Rollbacked is reply message that transaction is rollbacked

type TransactionSet

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

TransactionSet is set datastructure for transaction Ids

func NewTransactionSet

func NewTransactionSet() TransactionSet

NewTransactionSet returns empty set

func (*TransactionSet) Add

func (s *TransactionSet) Add(items ...string)

Add adds items to set if not already present

func (*TransactionSet) Contains

func (s *TransactionSet) Contains(items ...string) bool

Contains returns true if all items are present in set

func (*TransactionSet) Remove

func (s *TransactionSet) Remove(items ...string)

Remove removes items from set

func (*TransactionSet) Size

func (s *TransactionSet) Size() int

Size returns number of items in set

func (*TransactionSet) String

func (s *TransactionSet) String() string

func (*TransactionSet) Values

func (s *TransactionSet) Values() []string

Values returns slice of items in order or insertion

type Update

type Update struct {
	Version int
}

Update is inbound request to update snapshot

Jump to

Keyboard shortcuts

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