• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

yyle88 / goi18n / 14927697907

09 May 2025 11:13AM UTC coverage: 26.619%. First build
14927697907

push

github

yangyile1990
实现基本功能

74 of 278 new or added lines in 2 files covered. (26.62%)

74 of 278 relevant lines covered (26.62%)

0.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

55.96
/internal/examples/example1/example1generate/example1message/message.go
1
package example1message
2

3
import "github.com/nicksnyder/go-i18n/v2/i18n"
4

5
type ErrorAlreadyExistParam struct {
6
        What any
7
        Code any
8
}
9

10
func (p *ErrorAlreadyExistParam) GetTemplateValues() map[string]any {
2✔
11
        res := make(map[string]any)
2✔
12
        if p.What != nil {
4✔
13
                res["what"] = p.What
2✔
14
        }
2✔
15
        if p.Code != nil {
4✔
16
                res["code"] = p.Code
2✔
17
        }
2✔
18
        return res
2✔
19
}
20

NEW
21
func NewErrorAlreadyExist(data *ErrorAlreadyExistParam) (string, map[string]any) {
×
NEW
22
        return "ERROR_ALREADY_EXIST", data.GetTemplateValues()
×
NEW
23
}
×
24

25
func I18nErrorAlreadyExist(data *ErrorAlreadyExistParam) *i18n.LocalizeConfig {
2✔
26
        return &i18n.LocalizeConfig{
2✔
27
                MessageID:    "ERROR_ALREADY_EXIST",
2✔
28
                TemplateData: data.GetTemplateValues(),
2✔
29
        }
2✔
30
}
2✔
31

32
type ErrorBadParamParam struct {
33
        Name any
34
}
35

NEW
36
func (p *ErrorBadParamParam) GetTemplateValues() map[string]any {
×
NEW
37
        res := make(map[string]any)
×
NEW
38
        if p.Name != nil {
×
NEW
39
                res["name"] = p.Name
×
NEW
40
        }
×
NEW
41
        return res
×
42
}
43

NEW
44
func NewErrorBadParam(data *ErrorBadParamParam) (string, map[string]any) {
×
NEW
45
        return "ERROR_BAD_PARAM", data.GetTemplateValues()
×
NEW
46
}
×
47

NEW
48
func I18nErrorBadParam(data *ErrorBadParamParam) *i18n.LocalizeConfig {
×
NEW
49
        return &i18n.LocalizeConfig{
×
NEW
50
                MessageID:    "ERROR_BAD_PARAM",
×
NEW
51
                TemplateData: data.GetTemplateValues(),
×
NEW
52
        }
×
NEW
53
}
×
54

55
type ErrorNotExistParam struct {
56
        What any
57
        Code any
58
}
59

60
func (p *ErrorNotExistParam) GetTemplateValues() map[string]any {
2✔
61
        res := make(map[string]any)
2✔
62
        if p.What != nil {
4✔
63
                res["what"] = p.What
2✔
64
        }
2✔
65
        if p.Code != nil {
4✔
66
                res["code"] = p.Code
2✔
67
        }
2✔
68
        return res
2✔
69
}
70

NEW
71
func NewErrorNotExist(data *ErrorNotExistParam) (string, map[string]any) {
×
NEW
72
        return "ERROR_NOT_EXIST", data.GetTemplateValues()
×
NEW
73
}
×
74

75
func I18nErrorNotExist(data *ErrorNotExistParam) *i18n.LocalizeConfig {
2✔
76
        return &i18n.LocalizeConfig{
2✔
77
                MessageID:    "ERROR_NOT_EXIST",
2✔
78
                TemplateData: data.GetTemplateValues(),
2✔
79
        }
2✔
80
}
2✔
81

82
type NewMessagesParam struct {
83
        Name  any
84
        Count any
85
}
86

NEW
87
func (p *NewMessagesParam) GetTemplateValues() map[string]any {
×
NEW
88
        res := make(map[string]any)
×
NEW
89
        if p.Name != nil {
×
NEW
90
                res["name"] = p.Name
×
NEW
91
        }
×
NEW
92
        if p.Count != nil {
×
NEW
93
                res["count"] = p.Count
×
NEW
94
        }
×
NEW
95
        return res
×
96
}
97

NEW
98
func NewNewMessages(data *NewMessagesParam) (string, map[string]any) {
×
NEW
99
        return "NEW_MESSAGES", data.GetTemplateValues()
×
NEW
100
}
×
101

NEW
102
func I18nNewMessages(data *NewMessagesParam) *i18n.LocalizeConfig {
×
NEW
103
        return &i18n.LocalizeConfig{
×
NEW
104
                MessageID:    "NEW_MESSAGES",
×
NEW
105
                TemplateData: data.GetTemplateValues(),
×
NEW
106
        }
×
NEW
107
}
×
108

NEW
109
func NewPleaseConfirm[Value comparable](value Value) (string, Value) {
×
NEW
110
        return "PLEASE_CONFIRM", value
×
NEW
111
}
×
112

113
func I18nPleaseConfirm[Value comparable](value Value) *i18n.LocalizeConfig {
2✔
114
        return &i18n.LocalizeConfig{
2✔
115
                MessageID:    "PLEASE_CONFIRM",
2✔
116
                TemplateData: value,
2✔
117
        }
2✔
118
}
2✔
119

120
type SayHelloParam struct {
121
        Name any
122
}
123

124
func (p *SayHelloParam) GetTemplateValues() map[string]any {
4✔
125
        res := make(map[string]any)
4✔
126
        if p.Name != nil {
8✔
127
                res["name"] = p.Name
4✔
128
        }
4✔
129
        return res
4✔
130
}
131

132
func NewSayHello(data *SayHelloParam) (string, map[string]any) {
2✔
133
        return "SAY_HELLO", data.GetTemplateValues()
2✔
134
}
2✔
135

136
func I18nSayHello(data *SayHelloParam) *i18n.LocalizeConfig {
2✔
137
        return &i18n.LocalizeConfig{
2✔
138
                MessageID:    "SAY_HELLO",
2✔
139
                TemplateData: data.GetTemplateValues(),
2✔
140
        }
2✔
141
}
2✔
142

NEW
143
func NewSuccess() string {
×
NEW
144
        return "SUCCESS"
×
NEW
145
}
×
146

147
func I18nSuccess() *i18n.LocalizeConfig {
2✔
148
        return &i18n.LocalizeConfig{
2✔
149
                MessageID: "SUCCESS",
2✔
150
        }
2✔
151
}
2✔
152

NEW
153
func NewWelcome() string {
×
NEW
154
        return "WELCOME"
×
NEW
155
}
×
156

157
func I18nWelcome() *i18n.LocalizeConfig {
2✔
158
        return &i18n.LocalizeConfig{
2✔
159
                MessageID: "WELCOME",
2✔
160
        }
2✔
161
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc