ValidateFields checks the field values on User with the rules defined in the proto definition for this message. If any rules are violated, an error is returned.
(paths ...string)
| 261 | // ValidateFields checks the field values on User with the rules defined in the |
| 262 | // proto definition for this message. If any rules are violated, an error is returned. |
| 263 | func (m *User) ValidateFields(paths ...string) error { |
| 264 | if m == nil { |
| 265 | return nil |
| 266 | } |
| 267 | |
| 268 | if len(paths) == 0 { |
| 269 | paths = UserFieldPathsNested |
| 270 | } |
| 271 | |
| 272 | for name, subs := range _processPaths(append(paths[:0:0], paths...)) { |
| 273 | _ = subs |
| 274 | switch name { |
| 275 | case "ids": |
| 276 | |
| 277 | if m.GetIds() == nil { |
| 278 | return UserValidationError{ |
| 279 | field: "ids", |
| 280 | reason: "value is required", |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | if v, ok := interface{}(m.GetIds()).(interface{ ValidateFields(...string) error }); ok { |
| 285 | if err := v.ValidateFields(subs...); err != nil { |
| 286 | return UserValidationError{ |
| 287 | field: "ids", |
| 288 | reason: "embedded message failed validation", |
| 289 | cause: err, |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | case "created_at": |
| 295 | |
| 296 | if v, ok := interface{}(m.GetCreatedAt()).(interface{ ValidateFields(...string) error }); ok { |
| 297 | if err := v.ValidateFields(subs...); err != nil { |
| 298 | return UserValidationError{ |
| 299 | field: "created_at", |
| 300 | reason: "embedded message failed validation", |
| 301 | cause: err, |
| 302 | } |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | case "updated_at": |
| 307 | |
| 308 | if v, ok := interface{}(m.GetUpdatedAt()).(interface{ ValidateFields(...string) error }); ok { |
| 309 | if err := v.ValidateFields(subs...); err != nil { |
| 310 | return UserValidationError{ |
| 311 | field: "updated_at", |
| 312 | reason: "embedded message failed validation", |
| 313 | cause: err, |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | case "deleted_at": |
| 319 | |
| 320 | if v, ok := interface{}(m.GetDeletedAt()).(interface{ ValidateFields(...string) error }); ok { |