Documentation
¶
Index ¶
- Constants
- Variables
- func AccountingRoutesInternalKey(organizationID, ledgerID, key uuid.UUID) string
- func BalanceInternalKey(organizationID, ledgerID uuid.UUID, key string) string
- func BoolPtr(b bool) *bool
- func EnvFallback(prefixed, fallback string) string
- func EnvFallbackInt(prefixed, fallback int) int
- func Float64Ptr(f64 float64) *float64
- func FullJitter(baseDelay time.Duration) time.Duration
- func GenericInternalKey(name, organizationID, ledgerID, key string) string
- func GenericInternalKeyWithContext(name, contextName, organizationID, ledgerID, key string) string
- func IdempotencyInternalKey(organizationID, ledgerID uuid.UUID, key string) string
- func IntPtr(i int) *int
- func NextBackoff(current time.Duration) time.Duration
- func StringPtr(s string) *string
- func TransactionInternalKey(organizationID, ledgerID uuid.UUID, key string) string
- func ValidateAccountType(t string) error
- func ValidateCode(code string) error
- func ValidateCountryAddress(country string) error
- func ValidateCurrency(code string) error
- func ValidateType(t string) error
Constants ¶
const ( MaxRetries = 5 InitialBackoff = 500 * time.Millisecond MaxBackoff = 10 * time.Second BackoffFactor = 2.0 )
const BalanceSyncLockPrefix = "lock:{transactions}:balance-sync:"
const BalanceSyncScheduleKey = "schedule:{transactions}:balance-sync"
Variables ¶
var (
BalanceSynced = metrics.Metric{
Name: "balance_synced",
Unit: "1",
Description: "Measures the number of balances synced.",
}
)
Functions ¶
func AccountingRoutesInternalKey ¶ added in v3.5.0
AccountingRoutesInternalKey returns a non-contextual key (no cluster): "accounting_routes:{organizationID}:{ledgerID}:{key}"
func BalanceInternalKey ¶ added in v3.3.6
BalanceInternalKey returns a key with the following format to be used on redis cluster: "balance:{contextName}:organizationID:ledgerID:key"
func EnvFallback ¶ added in v3.5.0
EnvFallback returns the prefixed value if not empty, otherwise returns the fallback value. This is useful for supporting both prefixed env vars (e.g., DB_ONBOARDING_HOST) with fallback to non-prefixed (e.g., DB_HOST) for backward compatibility.
func EnvFallbackInt ¶ added in v3.5.0
EnvFallbackInt returns the prefixed value if not zero, otherwise returns the fallback value. This is useful for supporting both prefixed env vars with fallback to non-prefixed for backward compatibility.
func Float64Ptr ¶ added in v3.5.0
func FullJitter ¶
FullJitter returns a random delay between [0, baseDelay], capped by MaxBackoff.
func GenericInternalKey ¶ added in v3.3.6
GenericInternalKey returns a key with the following format to be used on non-cluster Redis: "name:{organizationID}:{ledgerID}:{key}"
func GenericInternalKeyWithContext ¶
GenericInternalKeyWithContext returns a key with the following format to be used on redis cluster: "name:{contextName}:organizationID:ledgerID:key"
func IdempotencyInternalKey ¶ added in v3.5.0
IdempotencyInternalKey returns a non-contextual key (no cluster): "idempotency:{organizationID}:{ledgerID}:{key}"
func NextBackoff ¶
NextBackoff calculates the next exponential backoff, respecting the MaxBackoff capped.
func TransactionInternalKey ¶ added in v3.3.6
TransactionInternalKey returns a key with the following format to be used on redis cluster: "transaction:{contextName}:organizationID:ledgerID:key"
func ValidateAccountType ¶ added in v3.5.0
ValidateAccountType validate type values of accounts
func ValidateCode ¶ added in v3.5.0
func ValidateCountryAddress ¶ added in v3.5.0
ValidateCountryAddress validate if country in object address contains in countries list using ISO 3166-1 alpha-2
func ValidateCurrency ¶ added in v3.5.0
ValidateCurrency validate if code contains in currencies list using ISO 4217
func ValidateType ¶ added in v3.5.0
ValidateType validate type values of currencies
Types ¶
This section is empty.