github.com/Bio-core/jtree@v0.0.0-20190705165106-1d7a7e7d6272/models/query.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  	strfmt "github.com/go-openapi/strfmt"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/swag"
    13  )
    14  
    15  // Query query
    16  // swagger:model Query
    17  type Query struct {
    18  
    19  	// selected condition
    20  	SelectedCondition [][]string `json:"selected_conditions"`
    21  
    22  	// selected fields
    23  	SelectedFields []string `json:"selected_fields"`
    24  
    25  	// selected tables
    26  	SelectedTables []string `json:"selected_tables"`
    27  }
    28  
    29  // Validate validates this query
    30  func (m *Query) Validate(formats strfmt.Registry) error {
    31  	var res []error
    32  
    33  	if err := m.validateSelectedCondition(formats); err != nil {
    34  		// prop
    35  		res = append(res, err)
    36  	}
    37  
    38  	if err := m.validateSelectedFields(formats); err != nil {
    39  		// prop
    40  		res = append(res, err)
    41  	}
    42  
    43  	if err := m.validateSelectedTables(formats); err != nil {
    44  		// prop
    45  		res = append(res, err)
    46  	}
    47  
    48  	if len(res) > 0 {
    49  		return errors.CompositeValidationError(res...)
    50  	}
    51  	return nil
    52  }
    53  
    54  func (m *Query) validateSelectedCondition(formats strfmt.Registry) error {
    55  
    56  	if swag.IsZero(m.SelectedCondition) { // not required
    57  		return nil
    58  	}
    59  
    60  	return nil
    61  }
    62  
    63  func (m *Query) validateSelectedFields(formats strfmt.Registry) error {
    64  
    65  	if swag.IsZero(m.SelectedFields) { // not required
    66  		return nil
    67  	}
    68  
    69  	return nil
    70  }
    71  
    72  func (m *Query) validateSelectedTables(formats strfmt.Registry) error {
    73  
    74  	if swag.IsZero(m.SelectedTables) { // not required
    75  		return nil
    76  	}
    77  
    78  	return nil
    79  }
    80  
    81  // MarshalBinary interface implementation
    82  func (m *Query) MarshalBinary() ([]byte, error) {
    83  	if m == nil {
    84  		return nil, nil
    85  	}
    86  	return swag.WriteJSON(m)
    87  }
    88  
    89  // UnmarshalBinary interface implementation
    90  func (m *Query) UnmarshalBinary(b []byte) error {
    91  	var res Query
    92  	if err := swag.ReadJSON(b, &res); err != nil {
    93  		return err
    94  	}
    95  	*m = res
    96  	return nil
    97  }