-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathtypes.go
58 lines (50 loc) · 1.22 KB
/
types.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package main
import (
"fmt"
)
type DbOpts struct {
DbPath string
Host string
User string
Dbname string
DbType string
Password string
}
// SQL Object
type Label struct {
Id int `sql:"index" json:"id"`
ExternalId string `json:"externalId"`
EncryptedLabel string `json:"encryptedLabel"`
Nonce int `json:"nonce"`
WalletId string `json:"walletId"`
}
// Rest response
type LabelsResponse struct {
Nonce int `json:"nonce"`
Labels []Label `json:"labels"`
}
// Rest request
type LabelRequest struct {
EncryptedLabel string `json:"encryptedLabel"`
ExternalId string `json:"externalId"`
WalletId string `json:"walletId"`
WalletNonce int `json:"walletNonce"`
}
func (self LabelRequest) String() string {
return fmt.Sprintf(`
Request information:
encryptedLabel: %s
externalId: %s
walletId: %s
walletNonce: %d
`, self.EncryptedLabel, self.ExternalId, self.WalletId, self.WalletNonce)
}
type LabelsRequest struct {
WalletNonce int `json:"walletNonce"`
WalletId string `json:"walletId"`
Labels []BatchLabel `json:"labels"`
}
type BatchLabel struct {
EncryptedLabel string `json:"encryptedLabel"`
ExternalId string `json:"externalId"`
}