-
Notifications
You must be signed in to change notification settings - Fork 0
/
transaction.go
43 lines (37 loc) · 1.08 KB
/
transaction.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
package transaction
import (
"database/sql/driver"
"encoding/json"
"errors"
"time"
)
// Transaction
type Transaction struct {
ID *int `json:"id"`
UUID string `json:"uuid"`
Name string `json:"name"`
AlternateName string `json:"alternateName"`
StartDate time.Time `json:"startDate"`
EndDate time.Time `json:"endDate"`
Description string `json:"description"`
TxHash string `json:"txHash"`
StatusID *int `json:"statusId"`
FromAccountID *int `json:"fromAccountId"`
ToAccountID *int `json:"toAccountId"`
ChainID *int `json:"chainId"`
CreatedBy string `json:"createdBy"`
CreatedAt time.Time `json:"createdAt"`
UpdatedBy string `json:"updatedBy"`
UpdatedAt time.Time `json:"updatedAt"`
}
type Attrs map[string]interface{}
func (a Attrs) Value() (driver.Value, error) {
return json.Marshal(a)
}
func (a *Attrs) Scan(value interface{}) error {
b, ok := value.([]byte)
if !ok {
return errors.New("type assertion to []byte failed")
}
return json.Unmarshal(b, &a)
}