MCPcopy Create free account
hub / github.com/6boris/web3-template / validate

Method validate

api/interface/web3/demo.pb.validate.go:487–565  ·  view source on GitHub ↗
(all bool)

Source from the content-addressed store, hash-verified

485}
486
487func (m *GetUserReply_Item) validate(all bool) error {
488 if m == nil {
489 return nil
490 }
491
492 var errors []error
493
494 // no validation rules for Id
495
496 // no validation rules for NickName
497
498 // no validation rules for AvatarUrl
499
500 // no validation rules for Email
501
502 if all {
503 switch v := interface{}(m.GetCreatedAt()).(type) {
504 case interface{ ValidateAll() error }:
505 if err := v.ValidateAll(); err != nil {
506 errors = append(errors, GetUserReply_ItemValidationError{
507 field: "CreatedAt",
508 reason: "embedded message failed validation",
509 cause: err,
510 })
511 }
512 case interface{ Validate() error }:
513 if err := v.Validate(); err != nil {
514 errors = append(errors, GetUserReply_ItemValidationError{
515 field: "CreatedAt",
516 reason: "embedded message failed validation",
517 cause: err,
518 })
519 }
520 }
521 } else if v, ok := interface{}(m.GetCreatedAt()).(interface{ Validate() error }); ok {
522 if err := v.Validate(); err != nil {
523 return GetUserReply_ItemValidationError{
524 field: "CreatedAt",
525 reason: "embedded message failed validation",
526 cause: err,
527 }
528 }
529 }
530
531 if all {
532 switch v := interface{}(m.GetUpdatedAt()).(type) {
533 case interface{ ValidateAll() error }:
534 if err := v.ValidateAll(); err != nil {
535 errors = append(errors, GetUserReply_ItemValidationError{
536 field: "UpdatedAt",
537 reason: "embedded message failed validation",
538 cause: err,
539 })
540 }
541 case interface{ Validate() error }:
542 if err := v.Validate(); err != nil {
543 errors = append(errors, GetUserReply_ItemValidationError{
544 field: "UpdatedAt",

Callers 2

ValidateMethod · 0.95
ValidateAllMethod · 0.95

Calls 5

GetCreatedAtMethod · 0.95
GetUpdatedAtMethod · 0.95
ValidateAllMethod · 0.45
ValidateMethod · 0.45

Tested by

no test coverage detected