mirror of
https://github.com/hanzoai/go-fulfillment.git
synced 2026-10-30 18:36:06 +00:00
85 lines
1.7 KiB
Go
85 lines
1.7 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 (
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/swag"
|
|
"github.com/go-openapi/validate"
|
|
)
|
|
|
|
// IsoCountry iso country
|
|
// swagger:model isoCountry
|
|
type IsoCountry struct {
|
|
|
|
// id
|
|
ID int64 `json:"id,omitempty"`
|
|
|
|
// Two character ISO code
|
|
// Maximum: 2
|
|
// Minimum: 2
|
|
// Pattern: [A-Z]{2}
|
|
Iso2 string `json:"iso2,omitempty"`
|
|
|
|
// Country Name
|
|
Name string `json:"name,omitempty"`
|
|
}
|
|
|
|
// Validate validates this iso country
|
|
func (m *IsoCountry) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateIso2(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *IsoCountry) validateIso2(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.Iso2) { // not required
|
|
return nil
|
|
}
|
|
|
|
if err := validate.Pattern("iso2", "body", string(m.Iso2), `[A-Z]{2}`); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.Minimum("iso2", "body", float64(m.Iso2), 2, false); err != nil {
|
|
return err
|
|
}
|
|
|
|
if err := validate.Maximum("iso2", "body", float64(m.Iso2), 2, false); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *IsoCountry) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *IsoCountry) UnmarshalBinary(b []byte) error {
|
|
var res IsoCountry
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|