-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtext_module_data.go
56 lines (45 loc) · 1.11 KB
/
text_module_data.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
package gpass
import "github.com/sonda2208/gpass/walletobjects"
type TextModuleData struct {
Body string
Header string
ID string
LocalizedBody *LocalizedString
LocalizedHeader *LocalizedString
}
func (d *TextModuleData) toWO() *walletobjects.TextModuleData {
if d == nil {
return nil
}
res := walletobjects.TextModuleData{
Body: d.Body,
Header: d.Header,
Id: d.ID,
}
if d.LocalizedBody != nil {
res.LocalizedBody = d.LocalizedBody.toWO()
}
if d.LocalizedHeader != nil {
res.LocalizedHeader = d.LocalizedHeader.toWO()
}
return &res
}
func listTextModuleDataToWO(d []*TextModuleData) []*walletobjects.TextModuleData {
res := make([]*walletobjects.TextModuleData, len(d))
for i, s := range d {
res[i] = s.toWO()
}
return res
}
func woToTextModuleData(d *walletobjects.TextModuleData) *TextModuleData {
if d == nil {
return nil
}
return &TextModuleData{
Body: d.Body,
Header: d.Header,
ID: d.Id,
LocalizedBody: woToLocalizedString(d.LocalizedBody),
LocalizedHeader: woToLocalizedString(d.LocalizedHeader),
}
}