-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.go
42 lines (35 loc) · 1.08 KB
/
account.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package models
// Account model
type Account struct {
Status string `bson:"status,omitempty" json:"status,omitempty"`
AccountType string `bson:"accounttype,omitempty" json:"accounttype,omitempty"`
Name string `validate:"required" bson:"name,omitempty" json:"name,omitempty"`
Public string `valid:"required,min=56,max=56" bson:"public" json:"public,omitempty"`
Secret string `valid:"required,min=56,max=56" bson:"secret" json:"secret,omitempty"`
}
type AccountTypeId int
const (
Primary AccountTypeId = iota
Secondary
Issuer
Distributor
OtherAccount
)
type AccountType struct {
AccountTypeId `json:"id"`
Name string `json:"name"`
Value string `json:"value"`
}
var AccountTypes = []AccountType{
{Primary, "primary", "primary"},
{Secondary, "secondary", "secondary"},
{Issuer, "issuer", "issuer"},
{Distributor, "distributor", "distributor"},
{OtherAccount, "otheraccount", "otheraccount"},
}
func (e *AccountType) GetAccountType() string {
return e.Name
}
func (c AccountTypeId) GetAccountType() string {
return AccountTypes[int(c)].Name
}