Versions in this module Expand all Collapse all v0 v0.1.1 Sep 5, 2025 Changes in this version + const TigerBeetleMaxBatch + var BNB *currency = newCurrency("BNB", 12) + var BTC *currency = newCurrency("BTC", 8) + var ETH *currency = newCurrency("ETH", 18) + var EUR *currency = newCurrency("EUR", 2) + var ErrAccountIDMustNotBeIntMax = errors.New("account id must not be 2^128 - 1") + var ErrAccountIDMustNotBeZero = errors.New("account id must not be zero") + var ErrBigIntOverflow = errors.New("big.Int overflows") + var ErrClientNil = errors.New("client TigeBeetle is nil") + var ErrCurrencyAmountMismatch = errors.New("currency mismatch") + var ErrExceedsMaxTigerBeetleBatch = fmt.Errorf("exceeds maximum batch size %d", TigerBeetleMaxBatch) + var ErrHexTooLong = errors.New("hex too long") + var ErrInvalidLength = errors.New("invalid length") + var ErrMonetaryMustNotBeNil = errors.New("account monetary must not be nil") + var ErrNegativeOrNilBigInt = errors.New("negative or nil big.Int") + var ErrOpenTBConnection = errors.New("failed to open TigerBeetle connection") + var ErrTimeMaxMustNotBeZero = errors.New("account transfer filter time max must not be zero") + var ErrTimeMinMustNotBeZero = errors.New("account transfer filter time min must not be zero") + var ErrUnknownCategory = errors.New("unknown account category") + var IDR *currency = newCurrency("IDR", 2) + var MYR *currency = newCurrency("MYR", 2) + var PHP *currency = newCurrency("PHP", 2) + var SGD *currency = newCurrency("SGD", 2) + var THB *currency = newCurrency("THB", 2) + var USD *currency = newCurrency("USD", 2) + var USDT *currency = newCurrency("USDT", 6) + var VND *currency = newCurrency("VND", 0) + func NewCurrency(code string, decimal uint8) (*currency, error) + type Account struct + Code uint16 + CreditsPending Amount + CreditsPosted Amount + DebitsPending Amount + DebitsPosted Amount + Flags AccountFlags + ID Uint128 + Ledger uint32 + Reserved uint32 + Timestamp uint64 + UserData128 Uint128 + UserData32 uint32 + UserData64 uint64 + type AccountBalance struct + CreditsPending Amount + CreditsPosted Amount + DebitsPending Amount + DebitsPosted Amount + Timestamp uint64 + type AccountCategory uint16 + const AccountCategoryBalance + const AccountCategoryControl + const AccountCategoryIncome + const AccountCategoryLiabilities + const AccountCategoryTesting + type AccountEventResult struct + Err error + ID Uint128 + Index uint32 + Result CreateAccountResult + type AccountEventResults struct + FailedCount int + Results []AccountEventResult + SuccessCount int + type AccountFilterFlags struct + Credits bool + Debits bool + Reversed bool + func (f AccountFilterFlags) ToUint32() uint32 + type AccountFlags struct + Closed bool + CreditsMustNotExceedDebits bool + DebitsMustNotExceedCredits bool + History bool + Imported bool + Linked bool + func (f AccountFlags) String() string + func (f AccountFlags) ToUint16() uint16 + type AccountLookup struct + ID Uint128 + Monetary Amount + type AccountStatement struct + Additional any + BalanceAfter Amount + BalanceBefore Amount + Code uint16 + Credit Amount + CreditAccountID Uint128 + Debit Amount + DebitAccountID Uint128 + Flags TransferFlags + ID Uint128 + Ledger uint32 + Timestamp uint64 + UserData128 Uint128 + UserData32 uint32 + UserData64 uint64 + type AccountTransfer struct + Amount Amount + Code uint16 + CreditAccountID Uint128 + DebitAccountID Uint128 + Flags TransferFlags + ID Uint128 + Ledger uint32 + PendingID Uint128 + Timeout uint32 + Timestamp uint64 + UserData128 Uint128 + UserData32 uint32 + UserData64 uint64 + type AccountTransferFilter struct + AccountID Uint128 + Code uint16 + Flags AccountFilterFlags + Limit uint32 + Monetary Amount + TimeMax time.Time + TimeMin time.Time + UserData128 Uint128 + UserData32 uint32 + UserData64 uint64 + type Amount interface + Add func(b Uint128) (Uint128, error) + Compare func(b Uint128) int + Div func(divisor float64) (Uint128, error) + Equal func(b Uint128) bool + Float64ToUint128 func() (Uint128, error) + GreaterThan func(b Uint128) bool + GreaterThanOrEqual func(b Uint128) bool + IsZero func() bool + LessThan func(b Uint128) bool + LessThanOrEqual func(b Uint128) bool + Max func(b Uint128) Uint128 + Min func(b Uint128) Uint128 + Mul func(multiplier float64) (Uint128, error) + Percentage func(percent float64) (Uint128, error) + SetFloat64Value func(val float64) Amount + SetUint128Value func(val Uint128) Amount + Sub func(b Uint128) (Uint128, error) + ToUint128FromValue func() Uint128 + Uint128ToFloat64 func() float64 + Uint128ToString func() string + type Config struct + Addresses string + ClusterID uint64 + DependencyPriority int + type CreateAccount struct + ID Uint128 + Ledger Ledger + UserData128 Uint128 + UserData32 uint32 + UserData64 uint64 + type CreateAccountResult = types.CreateAccountResult + type CreateAccounts struct + Code uint16 + Flags AccountFlags + Timestamp uint64 + type CreateTransferResult = types.CreateTransferResult + type Instance struct + func New() *Instance + func (i *Instance) Client() (tb.Client, error) + func (i *Instance) Close() error + func (i *Instance) CreateAccount(account CreateAccount, code uint16, flags AccountFlags) (AccountEventResult, error) + func (i *Instance) CreateAccountBatch(accounts []CreateAccounts) (AccountEventResults, error) + func (i *Instance) CreateAccountsWithCategory(category AccountCategory, accounts ...CreateAccount) (AccountEventResults, error) + func (i *Instance) CreatePendingTransfers(transfers []TransferData, linked bool, code uint16) (TransferEventResults, error) + func (i *Instance) CreateTransfers(transfers []TransferData) (TransferEventResults, error) + func (i *Instance) GetAccountStatements(filter AccountTransferFilter, closureFn ...StatementClosureFn) ([]AccountStatement, error) + func (i *Instance) GetAccountTransfers(filter AccountTransferFilter) ([]AccountTransfer, error) + func (i *Instance) GetHisotricalBalances(filter AccountTransferFilter) ([]AccountBalance, error) + func (i *Instance) HealthCheck(ctx context.Context) *qore.DependencyStats + func (i *Instance) LookupAccounts(lookups []AccountLookup) ([]Account, error) + func (i *Instance) Name() string + func (i *Instance) Open() error + func (i *Instance) Priority() int + func (i *Instance) ResolvePendingTransfers(pendings []PendingTransfer) (TransferEventResults, error) + type Ledger interface + DecodeLedger func() string + EncodeLedger func() LedgerCode + type LedgerCode uint32 + type PendingTransfer struct + Amount Amount + ID Uint128 + PendingID Uint128 + State ResolvePendingState + UserData32 uint32 + type ResolvePendingState uint8 + const ResolvePendingStatePost + const ResolvePendingStateVoid + type StatementClosureFn func(id, userData128 Uint128, userData64 uint64, userData32 uint32, code uint16, ...) any + type Transfer = types.Transfer + type TransferData struct + Amount Amount + CreditAccountID Uint128 + DebitAccountID Uint128 + ID Uint128 + Ledger Ledger + UserData128 Uint128 + UserData32 uint32 + UserData64 uint64 + type TransferEventResult struct + Err error + ID Uint128 + Index uint32 + Result CreateTransferResult + type TransferEventResults struct + FailedCount int + Results []TransferEventResult + SuccessCount int + type TransferFlags struct + BalancingCredit bool + BalancingDebit bool + ClosingCredit bool + ClosingDebit bool + Imported bool + Linked bool + Pending bool + PostPendingTransfer bool + VoidPendingTransfer bool + func (f TransferFlags) String() string + func (f TransferFlags) ToUint16() uint16 + type Uint128 struct + Hi uint64 + Lo uint64 + func NewID() Uint128 + func SafeNewID() (id Uint128, err error) + func Uint128FromBigInt(b *big.Int) (Uint128, error) + func Uint128FromBytesLE(b []byte) (Uint128, error) + func Uint128FromHex(s string) (Uint128, error) + func Uint128FromParts(hi, lo uint64) Uint128 + func Uint128FromUint64(v uint64) Uint128 + func (u *Uint128) UnmarshalJSON(b []byte) error + func (u *Uint128) UnmarshalText(b []byte) error + func (u Uint128) AppendHex(dst []byte) []byte + func (u Uint128) BigInt() *big.Int + func (u Uint128) BytesLE() [16]byte + func (u Uint128) Compare(v Uint128) int + func (u Uint128) Hex() string + func (u Uint128) IsZero() bool + func (u Uint128) MarshalJSON() ([]byte, error) + func (u Uint128) MarshalText() ([]byte, error) + func (u Uint128) String() string