// 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 ( "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Product product // // swagger:model Product type Product struct { // Api link APILink string `json:"ApiLink,omitempty" gorm:"-"` // cancel date // Format: date CancelDate *strfmt.Date `json:"CancelDate,omitempty" gorm:"type:date;default:2100-12-31"` // customer Id CustomerID string `json:"CustomerId,omitempty"` // deleted at // Format: datetime DeletedAt *strfmt.DateTime `json:"DeletedAt,omitempty" gorm:"type:timestamptz"` // discount Discount float64 `json:"Discount,omitempty" gorm:"type:numeric(23,13);default:0.0"` // name Name string `json:"Name,omitempty"` // plan Id PlanID string `json:"PlanId,omitempty" gorm:"default:'DEFAULT'"` // product Id ProductID string `json:"ProductId,omitempty" gorm:"primary_key;unique;default:md5(random()::text || clock_timestamp()::text)::uuid"` // type Type string `json:"Type,omitempty"` } // Validate validates this product func (m *Product) Validate(formats strfmt.Registry) error { var res []error if err := m.validateCancelDate(formats); err != nil { res = append(res, err) } if err := m.validateDeletedAt(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *Product) validateCancelDate(formats strfmt.Registry) error { if swag.IsZero(m.CancelDate) { // not required return nil } if err := validate.FormatOf("CancelDate", "body", "date", m.CancelDate.String(), formats); err != nil { return err } return nil } func (m *Product) validateDeletedAt(formats strfmt.Registry) error { if swag.IsZero(m.DeletedAt) { // not required return nil } if err := validate.FormatOf("DeletedAt", "body", "datetime", m.DeletedAt.String(), formats); err != nil { return err } return nil } // MarshalBinary interface implementation func (m *Product) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *Product) UnmarshalBinary(b []byte) error { var res Product if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }