github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/oracle_queries.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  // OracleQueries oracle queries
    19  // swagger:model OracleQueries
    20  type OracleQueries struct {
    21  
    22  	// oracle queries
    23  	// Required: true
    24  	OracleQueries []*OracleQuery `json:"oracle_queries"`
    25  }
    26  
    27  // Validate validates this oracle queries
    28  func (m *OracleQueries) Validate(formats strfmt.Registry) error {
    29  	var res []error
    30  
    31  	if err := m.validateOracleQueries(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 *OracleQueries) validateOracleQueries(formats strfmt.Registry) error {
    42  
    43  	if err := validate.Required("oracle_queries", "body", m.OracleQueries); err != nil {
    44  		return err
    45  	}
    46  
    47  	for i := 0; i < len(m.OracleQueries); i++ {
    48  		if swag.IsZero(m.OracleQueries[i]) { // not required
    49  			continue
    50  		}
    51  
    52  		if m.OracleQueries[i] != nil {
    53  			if err := m.OracleQueries[i].Validate(formats); err != nil {
    54  				if ve, ok := err.(*errors.Validation); ok {
    55  					return ve.ValidateName("oracle_queries" + "." + strconv.Itoa(i))
    56  				}
    57  				return err
    58  			}
    59  		}
    60  
    61  	}
    62  
    63  	return nil
    64  }
    65  
    66  // MarshalBinary interface implementation
    67  func (m *OracleQueries) 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 *OracleQueries) UnmarshalBinary(b []byte) error {
    76  	var res OracleQueries
    77  	if err := swag.ReadJSON(b, &res); err != nil {
    78  		return err
    79  	}
    80  	*m = res
    81  	return nil
    82  }