Documentation ¶
Index ¶
- Constants
- func Apply(session *mgo.Session, tx *Transaction) error
- func BeginTransaction(txn string, debit map[string]int64, credit map[string]int64, note string) (string, error)
- func CommitTransaction() error
- func Connect()
- func CreateAccount(acID string, side AccountSide) error
- func Disconnect()
- func IsDuplicatedAcctErr(err error) bool
- func IsUnbalancedErr(err error) bool
- func MarkDone(session *mgo.Session, tx *Transaction) error
- func ReadBalance(account string) (int64, error)
- func Recover() error
- type Account
- type AccountSide
- type Transaction
- type TxState
Constants ¶
View Source
const ( TxInitial TxState = "init" TxPending = "pend" TxApplied = "appl" TxDone = "done" TxCanceling = "cing" TxCanceled = "canc" )
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(session *mgo.Session, tx *Transaction) error
func BeginTransaction ¶
func CommitTransaction ¶
func CommitTransaction() error
func CreateAccount ¶
func CreateAccount(acID string, side AccountSide) error
func Disconnect ¶
func Disconnect()
func IsDuplicatedAcctErr ¶
func IsUnbalancedErr ¶
func MarkDone ¶
func MarkDone(session *mgo.Session, tx *Transaction) error
func ReadBalance ¶
Types ¶
type AccountSide ¶
type AccountSide string
const ( AccountSideDebit AccountSide = "dbt" AccountSideCredit = "crd" )
type Transaction ¶
Click to show internal directories.
Click to hide internal directories.