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

s7techlab / hlf-sdk-go / 6615655079

23 Oct 2023 03:42PM UTC coverage: 4.092% (-1.7%) from 5.771%
6615655079

Pull #135

github

Nikita Neznaemov
write-struct 15
Pull Request #135: write-struct

2885 of 2885 new or added lines in 21 files covered. (100.0%)

446 of 10900 relevant lines covered (4.09%)

0.18 hits per line

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

0.0
/block/smartbft/common/common.pb.validate.go
1
// Code generated by protoc-gen-validate. DO NOT EDIT.
2
// source: smartbft/common/common.proto
3

4
package common
5

6
import (
7
        "bytes"
8
        "errors"
9
        "fmt"
10
        "net"
11
        "net/mail"
12
        "net/url"
13
        "regexp"
14
        "sort"
15
        "strings"
16
        "time"
17
        "unicode/utf8"
18

19
        "google.golang.org/protobuf/types/known/anypb"
20
)
21

22
// ensure the imports are used
23
var (
24
        _ = bytes.MinRead
25
        _ = errors.New("")
26
        _ = fmt.Print
27
        _ = utf8.UTFMax
28
        _ = (*regexp.Regexp)(nil)
29
        _ = (*strings.Reader)(nil)
30
        _ = net.IPv4len
31
        _ = time.Duration(0)
32
        _ = (*url.URL)(nil)
33
        _ = (*mail.Address)(nil)
34
        _ = anypb.Any{}
35
        _ = sort.Sort
36
)
37

38
// Validate checks the field values on BFTMetadata with the rules defined in
39
// the proto definition for this message. If any rules are violated, the first
40
// error encountered is returned, or nil if there are no violations.
41
func (m *BFTMetadata) Validate() error {
×
42
        return m.validate(false)
×
43
}
×
44

45
// ValidateAll checks the field values on BFTMetadata with the rules defined in
46
// the proto definition for this message. If any rules are violated, the
47
// result is a list of violation errors wrapped in BFTMetadataMultiError, or
48
// nil if none found.
49
func (m *BFTMetadata) ValidateAll() error {
×
50
        return m.validate(true)
×
51
}
×
52

53
func (m *BFTMetadata) validate(all bool) error {
×
54
        if m == nil {
×
55
                return nil
×
56
        }
×
57

58
        var errors []error
×
59

×
60
        // no validation rules for Value
×
61

×
62
        for idx, item := range m.GetSignatures() {
×
63
                _, _ = idx, item
×
64

×
65
                if all {
×
66
                        switch v := interface{}(item).(type) {
×
67
                        case interface{ ValidateAll() error }:
×
68
                                if err := v.ValidateAll(); err != nil {
×
69
                                        errors = append(errors, BFTMetadataValidationError{
×
70
                                                field:  fmt.Sprintf("Signatures[%v]", idx),
×
71
                                                reason: "embedded message failed validation",
×
72
                                                cause:  err,
×
73
                                        })
×
74
                                }
×
75
                        case interface{ Validate() error }:
×
76
                                if err := v.Validate(); err != nil {
×
77
                                        errors = append(errors, BFTMetadataValidationError{
×
78
                                                field:  fmt.Sprintf("Signatures[%v]", idx),
×
79
                                                reason: "embedded message failed validation",
×
80
                                                cause:  err,
×
81
                                        })
×
82
                                }
×
83
                        }
84
                } else if v, ok := interface{}(item).(interface{ Validate() error }); ok {
×
85
                        if err := v.Validate(); err != nil {
×
86
                                return BFTMetadataValidationError{
×
87
                                        field:  fmt.Sprintf("Signatures[%v]", idx),
×
88
                                        reason: "embedded message failed validation",
×
89
                                        cause:  err,
×
90
                                }
×
91
                        }
×
92
                }
93

94
        }
95

96
        if len(errors) > 0 {
×
97
                return BFTMetadataMultiError(errors)
×
98
        }
×
99

100
        return nil
×
101
}
102

103
// BFTMetadataMultiError is an error wrapping multiple validation errors
104
// returned by BFTMetadata.ValidateAll() if the designated constraints aren't met.
105
type BFTMetadataMultiError []error
106

107
// Error returns a concatenation of all the error messages it wraps.
108
func (m BFTMetadataMultiError) Error() string {
×
109
        var msgs []string
×
110
        for _, err := range m {
×
111
                msgs = append(msgs, err.Error())
×
112
        }
×
113
        return strings.Join(msgs, "; ")
×
114
}
115

116
// AllErrors returns a list of validation violation errors.
117
func (m BFTMetadataMultiError) AllErrors() []error { return m }
×
118

119
// BFTMetadataValidationError is the validation error returned by
120
// BFTMetadata.Validate if the designated constraints aren't met.
121
type BFTMetadataValidationError struct {
122
        field  string
123
        reason string
124
        cause  error
125
        key    bool
126
}
127

128
// Field function returns field value.
129
func (e BFTMetadataValidationError) Field() string { return e.field }
×
130

131
// Reason function returns reason value.
132
func (e BFTMetadataValidationError) Reason() string { return e.reason }
×
133

134
// Cause function returns cause value.
135
func (e BFTMetadataValidationError) Cause() error { return e.cause }
×
136

137
// Key function returns key value.
138
func (e BFTMetadataValidationError) Key() bool { return e.key }
×
139

140
// ErrorName returns error name.
141
func (e BFTMetadataValidationError) ErrorName() string { return "BFTMetadataValidationError" }
×
142

143
// Error satisfies the builtin error interface
144
func (e BFTMetadataValidationError) Error() string {
×
145
        cause := ""
×
146
        if e.cause != nil {
×
147
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
148
        }
×
149

150
        key := ""
×
151
        if e.key {
×
152
                key = "key for "
×
153
        }
×
154

155
        return fmt.Sprintf(
×
156
                "invalid %sBFTMetadata.%s: %s%s",
×
157
                key,
×
158
                e.field,
×
159
                e.reason,
×
160
                cause)
×
161
}
162

163
var _ error = BFTMetadataValidationError{}
164

165
var _ interface {
166
        Field() string
167
        Reason() string
168
        Key() bool
169
        Cause() error
170
        ErrorName() string
171
} = BFTMetadataValidationError{}
172

173
// Validate checks the field values on BFTMetadataSignature with the rules
174
// defined in the proto definition for this message. If any rules are
175
// violated, the first error encountered is returned, or nil if there are no violations.
176
func (m *BFTMetadataSignature) Validate() error {
×
177
        return m.validate(false)
×
178
}
×
179

180
// ValidateAll checks the field values on BFTMetadataSignature with the rules
181
// defined in the proto definition for this message. If any rules are
182
// violated, the result is a list of violation errors wrapped in
183
// BFTMetadataSignatureMultiError, or nil if none found.
184
func (m *BFTMetadataSignature) ValidateAll() error {
×
185
        return m.validate(true)
×
186
}
×
187

188
func (m *BFTMetadataSignature) validate(all bool) error {
×
189
        if m == nil {
×
190
                return nil
×
191
        }
×
192

193
        var errors []error
×
194

×
195
        // no validation rules for SignatureHeader
×
196

×
197
        // no validation rules for Signature
×
198

×
199
        // no validation rules for SignerId
×
200

×
201
        // no validation rules for Nonce
×
202

×
203
        if len(errors) > 0 {
×
204
                return BFTMetadataSignatureMultiError(errors)
×
205
        }
×
206

207
        return nil
×
208
}
209

210
// BFTMetadataSignatureMultiError is an error wrapping multiple validation
211
// errors returned by BFTMetadataSignature.ValidateAll() if the designated
212
// constraints aren't met.
213
type BFTMetadataSignatureMultiError []error
214

215
// Error returns a concatenation of all the error messages it wraps.
216
func (m BFTMetadataSignatureMultiError) Error() string {
×
217
        var msgs []string
×
218
        for _, err := range m {
×
219
                msgs = append(msgs, err.Error())
×
220
        }
×
221
        return strings.Join(msgs, "; ")
×
222
}
223

224
// AllErrors returns a list of validation violation errors.
225
func (m BFTMetadataSignatureMultiError) AllErrors() []error { return m }
×
226

227
// BFTMetadataSignatureValidationError is the validation error returned by
228
// BFTMetadataSignature.Validate if the designated constraints aren't met.
229
type BFTMetadataSignatureValidationError struct {
230
        field  string
231
        reason string
232
        cause  error
233
        key    bool
234
}
235

236
// Field function returns field value.
237
func (e BFTMetadataSignatureValidationError) Field() string { return e.field }
×
238

239
// Reason function returns reason value.
240
func (e BFTMetadataSignatureValidationError) Reason() string { return e.reason }
×
241

242
// Cause function returns cause value.
243
func (e BFTMetadataSignatureValidationError) Cause() error { return e.cause }
×
244

245
// Key function returns key value.
246
func (e BFTMetadataSignatureValidationError) Key() bool { return e.key }
×
247

248
// ErrorName returns error name.
249
func (e BFTMetadataSignatureValidationError) ErrorName() string {
×
250
        return "BFTMetadataSignatureValidationError"
×
251
}
×
252

253
// Error satisfies the builtin error interface
254
func (e BFTMetadataSignatureValidationError) Error() string {
×
255
        cause := ""
×
256
        if e.cause != nil {
×
257
                cause = fmt.Sprintf(" | caused by: %v", e.cause)
×
258
        }
×
259

260
        key := ""
×
261
        if e.key {
×
262
                key = "key for "
×
263
        }
×
264

265
        return fmt.Sprintf(
×
266
                "invalid %sBFTMetadataSignature.%s: %s%s",
×
267
                key,
×
268
                e.field,
×
269
                e.reason,
×
270
                cause)
×
271
}
272

273
var _ error = BFTMetadataSignatureValidationError{}
274

275
var _ interface {
276
        Field() string
277
        Reason() string
278
        Key() bool
279
        Cause() error
280
        ErrorName() string
281
} = BFTMetadataSignatureValidationError{}
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

© 2026 Coveralls, Inc