src.dualinventive.com/go/companies-service/rest/models/companies_list.go

84 lines
1.6 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"strconv"
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// CompaniesList companies list
// swagger:model CompaniesList
type CompaniesList struct {
// company
Company []*Company `json:"company"`
// count
Count int64 `json:"count,omitempty"`
}
// Validate validates this companies list
func (m *CompaniesList) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCompany(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CompaniesList) validateCompany(formats strfmt.Registry) error {
if swag.IsZero(m.Company) { // not required
return nil
}
for i := 0; i < len(m.Company); i++ {
if swag.IsZero(m.Company[i]) { // not required
continue
}
if m.Company[i] != nil {
if err := m.Company[i].Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("company" + "." + strconv.Itoa(i))
}
return err
}
}
}
return nil
}
// MarshalBinary interface implementation
func (m *CompaniesList) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CompaniesList) UnmarshalBinary(b []byte) error {
var res CompaniesList
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}