github.com/s7techlab/cckit@v0.10.5/examples/cpaper_extended/schema/payload.validator.pb.go (about)

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: cpaper_extended/schema/payload.proto
     3  
     4  package schema
     5  
     6  import (
     7  	fmt "fmt"
     8  	proto "github.com/golang/protobuf/proto"
     9  	_ "github.com/mwitkow/go-proto-validators"
    10  	github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
    11  	_ "google.golang.org/protobuf/types/known/timestamppb"
    12  	math "math"
    13  )
    14  
    15  // Reference imports to suppress errors if they are not otherwise used.
    16  var _ = proto.Marshal
    17  var _ = fmt.Errorf
    18  var _ = math.Inf
    19  
    20  func (this *IssueCommercialPaper) Validate() error {
    21  	if this.Issuer == "" {
    22  		return github_com_mwitkow_go_proto_validators.FieldError("Issuer", fmt.Errorf(`value '%v' must not be an empty string`, this.Issuer))
    23  	}
    24  	if this.PaperNumber == "" {
    25  		return github_com_mwitkow_go_proto_validators.FieldError("PaperNumber", fmt.Errorf(`value '%v' must not be an empty string`, this.PaperNumber))
    26  	}
    27  	if nil == this.IssueDate {
    28  		return github_com_mwitkow_go_proto_validators.FieldError("IssueDate", fmt.Errorf("message must exist"))
    29  	}
    30  	if this.IssueDate != nil {
    31  		if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.IssueDate); err != nil {
    32  			return github_com_mwitkow_go_proto_validators.FieldError("IssueDate", err)
    33  		}
    34  	}
    35  	if nil == this.MaturityDate {
    36  		return github_com_mwitkow_go_proto_validators.FieldError("MaturityDate", fmt.Errorf("message must exist"))
    37  	}
    38  	if this.MaturityDate != nil {
    39  		if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.MaturityDate); err != nil {
    40  			return github_com_mwitkow_go_proto_validators.FieldError("MaturityDate", err)
    41  		}
    42  	}
    43  	if !(this.FaceValue > 0) {
    44  		return github_com_mwitkow_go_proto_validators.FieldError("FaceValue", fmt.Errorf(`value '%v' must be greater than '0'`, this.FaceValue))
    45  	}
    46  	if this.ExternalId == "" {
    47  		return github_com_mwitkow_go_proto_validators.FieldError("ExternalId", fmt.Errorf(`value '%v' must not be an empty string`, this.ExternalId))
    48  	}
    49  	return nil
    50  }
    51  func (this *BuyCommercialPaper) Validate() error {
    52  	if this.Issuer == "" {
    53  		return github_com_mwitkow_go_proto_validators.FieldError("Issuer", fmt.Errorf(`value '%v' must not be an empty string`, this.Issuer))
    54  	}
    55  	if this.PaperNumber == "" {
    56  		return github_com_mwitkow_go_proto_validators.FieldError("PaperNumber", fmt.Errorf(`value '%v' must not be an empty string`, this.PaperNumber))
    57  	}
    58  	if this.CurrentOwner == "" {
    59  		return github_com_mwitkow_go_proto_validators.FieldError("CurrentOwner", fmt.Errorf(`value '%v' must not be an empty string`, this.CurrentOwner))
    60  	}
    61  	if this.NewOwner == "" {
    62  		return github_com_mwitkow_go_proto_validators.FieldError("NewOwner", fmt.Errorf(`value '%v' must not be an empty string`, this.NewOwner))
    63  	}
    64  	if !(this.Price > 0) {
    65  		return github_com_mwitkow_go_proto_validators.FieldError("Price", fmt.Errorf(`value '%v' must be greater than '0'`, this.Price))
    66  	}
    67  	if nil == this.PurchaseDate {
    68  		return github_com_mwitkow_go_proto_validators.FieldError("PurchaseDate", fmt.Errorf("message must exist"))
    69  	}
    70  	if this.PurchaseDate != nil {
    71  		if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.PurchaseDate); err != nil {
    72  			return github_com_mwitkow_go_proto_validators.FieldError("PurchaseDate", err)
    73  		}
    74  	}
    75  	return nil
    76  }
    77  func (this *RedeemCommercialPaper) Validate() error {
    78  	if this.Issuer == "" {
    79  		return github_com_mwitkow_go_proto_validators.FieldError("Issuer", fmt.Errorf(`value '%v' must not be an empty string`, this.Issuer))
    80  	}
    81  	if this.PaperNumber == "" {
    82  		return github_com_mwitkow_go_proto_validators.FieldError("PaperNumber", fmt.Errorf(`value '%v' must not be an empty string`, this.PaperNumber))
    83  	}
    84  	if this.RedeemingOwner == "" {
    85  		return github_com_mwitkow_go_proto_validators.FieldError("RedeemingOwner", fmt.Errorf(`value '%v' must not be an empty string`, this.RedeemingOwner))
    86  	}
    87  	if nil == this.RedeemDate {
    88  		return github_com_mwitkow_go_proto_validators.FieldError("RedeemDate", fmt.Errorf("message must exist"))
    89  	}
    90  	if this.RedeemDate != nil {
    91  		if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(this.RedeemDate); err != nil {
    92  			return github_com_mwitkow_go_proto_validators.FieldError("RedeemDate", err)
    93  		}
    94  	}
    95  	return nil
    96  }