github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/generic_txs.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "strconv" 10 11 strfmt "github.com/go-openapi/strfmt" 12 13 "github.com/go-openapi/errors" 14 "github.com/go-openapi/swag" 15 "github.com/go-openapi/validate" 16 ) 17 18 // GenericTxs generic txs 19 // swagger:model GenericTxs 20 type GenericTxs struct { 21 22 // transactions 23 // Required: true 24 Transactions []*GenericSignedTx `json:"transactions"` 25 } 26 27 // Validate validates this generic txs 28 func (m *GenericTxs) Validate(formats strfmt.Registry) error { 29 var res []error 30 31 if err := m.validateTransactions(formats); err != nil { 32 res = append(res, err) 33 } 34 35 if len(res) > 0 { 36 return errors.CompositeValidationError(res...) 37 } 38 return nil 39 } 40 41 func (m *GenericTxs) validateTransactions(formats strfmt.Registry) error { 42 43 if err := validate.Required("transactions", "body", m.Transactions); err != nil { 44 return err 45 } 46 47 for i := 0; i < len(m.Transactions); i++ { 48 if swag.IsZero(m.Transactions[i]) { // not required 49 continue 50 } 51 52 if m.Transactions[i] != nil { 53 if err := m.Transactions[i].Validate(formats); err != nil { 54 if ve, ok := err.(*errors.Validation); ok { 55 return ve.ValidateName("transactions" + "." + strconv.Itoa(i)) 56 } 57 return err 58 } 59 } 60 61 } 62 63 return nil 64 } 65 66 // MarshalBinary interface implementation 67 func (m *GenericTxs) MarshalBinary() ([]byte, error) { 68 if m == nil { 69 return nil, nil 70 } 71 return swag.WriteJSON(m) 72 } 73 74 // UnmarshalBinary interface implementation 75 func (m *GenericTxs) UnmarshalBinary(b []byte) error { 76 var res GenericTxs 77 if err := swag.ReadJSON(b, &res); err != nil { 78 return err 79 } 80 *m = res 81 return nil 82 }