Documentation
¶
Index ¶
- Variables
- type Account
- type AccountID
- type AccountName
- type AccountOperation
- type AccountOperationID
- type AccountState
- type AccountStatus
- type Base58
- type Credential
- type Currency
- type CurrencyAvailable
- type CurrencyName
- type CurrencyRate
- type CurrencyRateID
- type CurrencyRateSource
- type CurrencyRateValue
- type Float
- type ID
- type Int
- type Model
- type OAuth
- type OAuthData
- type OperationType
- type RefID
- type String
- type SynchroneousType
- type User
- type UserEmail
- type UserID
- type UserName
- type ZeroFloat
- type ZeroInt
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrAccountStatusInvalid = errors.New("Invalid AccountStatus")
)
View Source
var (
ErrOperationTypeInvalid = errors.New("Invalid OperationType")
)
View Source
var (
ErrSynchroneousTypeInvalid = errors.New("Invalid SynchroneousType")
)
Functions ¶
This section is empty.
Types ¶
type Account ¶ added in v0.0.2
type Account struct { ID AccountID `gorm:"primary_key"` // [PK] Account UserID UserID `gorm:"index;not null"` // [FK] Reference to User table CurrencyName CurrencyName `gorm:"index;not null;type:varchar(16)"` // [FK] Reference to Currency table Name AccountName `gorm:"index;not null"` // [U] Unique Account name for User and Currency }
type AccountName ¶ added in v0.0.2
type AccountName String
type AccountOperation ¶ added in v0.0.2
type AccountOperation struct { ID AccountOperationID `gorm:"primary_key;unique_index:idx_id_previd;"` // [PK] AccountOperation PrevID AccountOperationID `gorm:"unique_index:idx_id_previd;not null"` // [FK] Reference to previous AccountOperation (0 mean first operation) AccountID AccountID `gorm:"index;not null"` // [FK] Reference to Account table SynchroneousType SynchroneousType `gorm:"index;not null;type:varchar(16)"` // [enum] Operation synchroneous type (sync, async-start, async-end) OperationType OperationType `gorm:"index;not null;type:varchar(16)"` // [enum] Determine table for ReferenceID (deposit, withdraw, transfert, adjustment, none, other) ReferenceID RefID `gorm:"index;not null"` // [optional - FK] Reference to related table with OperationType Timestamp time.Time `gorm:"index;not null;type:timestamp"` // Operation timestamp Amount ZeroFloat `gorm:"default:0;not null"` // Operation amount (can be negative) Balance ZeroFloat `gorm:"default:0;not null"` // Account balance (strictly positive or zero) LockAmount ZeroFloat `gorm:"default:0;not null"` // Operation amount (can be negative) TotalLocked ZeroFloat `gorm:"default:0;not null"` // Total locked (strictly positive or zero and less or equal than Balance) }
AccountOperation model
func NewAccountOperation ¶ added in v0.0.2
func NewAccountOperation(ID, prevID AccountOperationID, accountID AccountID, synchroneousType SynchroneousType, operationType OperationType, referenceID RefID, timestamp time.Time, amount, balance, lockAmount, totalLocked Float) AccountOperation
func (*AccountOperation) IsValid ¶ added in v0.0.2
func (p *AccountOperation) IsValid() bool
func (*AccountOperation) PreCheck ¶ added in v0.0.2
func (p *AccountOperation) PreCheck() bool
type AccountOperationID ¶ added in v0.0.2
type AccountOperationID ID
type AccountState ¶ added in v0.0.2
type AccountState struct { AccountID AccountID `gorm:"unique_index;not null"` // [FK] Reference to Account table State AccountStatus `gorm:"index;not null;type:varchar(16)"` // AccountStatus [normal, locked, disabled] }
type AccountStatus ¶ added in v0.0.2
type AccountStatus String
const ( AccountStatusInvalid AccountStatus = "" AccountStatusCreated AccountStatus = "created" AccountStatusNormal AccountStatus = "normal" AccountStatusLocked AccountStatus = "locked" AccountStatusDisabled AccountStatus = "disabled" )
func ParseAccountStatus ¶ added in v0.0.2
func ParseAccountStatus(str string) AccountStatus
func (AccountStatus) String ¶ added in v0.0.2
func (p AccountStatus) String() string
func (AccountStatus) Valid ¶ added in v0.0.2
func (p AccountStatus) Valid() bool
type Credential ¶
type Currency ¶ added in v0.0.2
type Currency struct { Name CurrencyName `gorm:"primary_key;type:varchar(16)"` // [PK] Currency Available ZeroInt `gorm:"default:0;not null"` Crypto ZeroInt `gorm:"default:0;not null"` Precision ZeroInt `gorm:"default:2;not null"` }
func NewCurrency ¶ added in v0.0.2
func NewCurrency(name CurrencyName, available, crypto, precision Int) Currency
func (*Currency) DisplayPrecision ¶ added in v0.0.2
func (*Currency) IsAvailable ¶ added in v0.0.2
type CurrencyAvailable ¶ added in v0.0.2
type CurrencyAvailable ZeroInt
type CurrencyName ¶ added in v0.0.2
type CurrencyName String
type CurrencyRate ¶ added in v0.0.2
type CurrencyRate struct { ID CurrencyRateID `gorm:"primary_key"` Timestamp time.Time `gorm:"index;not null;type:timestamp"` Source CurrencyRateSource `gorm:"index;not null;type:varchar(16)"` Base CurrencyName `gorm:"index;not null;type:varchar(16)"` Name CurrencyName `gorm:"index;not null;type:varchar(16)"` Rate CurrencyRateValue `gorm:"not null"` }
type CurrencyRateID ¶ added in v0.0.2
type CurrencyRateID ID
type CurrencyRateSource ¶ added in v0.0.2
type CurrencyRateSource String
type CurrencyRateValue ¶ added in v0.0.2
type CurrencyRateValue Float
type OAuth ¶ added in v0.0.2
type OAuth struct { ID ID `gorm:"primary_key"` // [PK] OAuth Provider string `gorm:"unique_index:idx_prov_provid;not null;type:varchar(16)"` // [U] Provider name ProviderID string `gorm:"unique_index:idx_prov_provid;not null;type:varchar(64)"` // [U] Provider unique ID (from goth User.UserID) UserID UserID `gorm:"index;not null"` // [FK] Reference to User table. Same user can have multiple providers }
type OperationType ¶ added in v0.0.2
type OperationType String
const ( OperationTypeInvalid OperationType = "" OperationTypeDeposit OperationType = "deposit" OperationTypeWithdraw OperationType = "withdraw" OperationTypeTransfert OperationType = "transfert" OperationTypeAdjustment OperationType = "adjustment" OperationTypeNone OperationType = "none" OperationTypeOther OperationType = "other" )
func ParseOperationType ¶ added in v0.0.2
func ParseOperationType(str string) OperationType
func (OperationType) String ¶ added in v0.0.2
func (p OperationType) String() string
func (OperationType) Valid ¶ added in v0.0.2
func (p OperationType) Valid() bool
type SynchroneousType ¶ added in v0.0.2
type SynchroneousType String
const ( SynchroneousTypeInvalid SynchroneousType = "" SynchroneousTypeSync SynchroneousType = "sync" SynchroneousTypeAsyncStart SynchroneousType = "async-start" SynchroneousTypeAsyncEnd SynchroneousType = "async-end" )
func ParseSynchroneousType ¶ added in v0.0.2
func ParseSynchroneousType(str string) SynchroneousType
func (SynchroneousType) String ¶ added in v0.0.2
func (p SynchroneousType) String() string
func (SynchroneousType) Valid ¶ added in v0.0.2
func (p SynchroneousType) Valid() bool
Click to show internal directories.
Click to hide internal directories.