zrok/rest_model/base_entity.go
2022-07-25 11:44:17 -04:00

111 lines
2.3 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package rest_model
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// BaseEntity Fields shared by all zrok entities
//
// swagger:model baseEntity
type BaseEntity struct {
// created at
// Required: true
CreatedAt *string `json:"createdAt"`
// id
// Required: true
ID *string `json:"id"`
// updated at
// Required: true
// Format: date-time
UpdatedAt *strfmt.DateTime `json:"updatedAt"`
}
// Validate validates this base entity
func (m *BaseEntity) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCreatedAt(formats); err != nil {
res = append(res, err)
}
if err := m.validateID(formats); err != nil {
res = append(res, err)
}
if err := m.validateUpdatedAt(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *BaseEntity) validateCreatedAt(formats strfmt.Registry) error {
if err := validate.Required("createdAt", "body", m.CreatedAt); err != nil {
return err
}
return nil
}
func (m *BaseEntity) validateID(formats strfmt.Registry) error {
if err := validate.Required("id", "body", m.ID); err != nil {
return err
}
return nil
}
func (m *BaseEntity) validateUpdatedAt(formats strfmt.Registry) error {
if err := validate.Required("updatedAt", "body", m.UpdatedAt); err != nil {
return err
}
if err := validate.FormatOf("updatedAt", "body", "date-time", m.UpdatedAt.String(), formats); err != nil {
return err
}
return nil
}
// ContextValidate validates this base entity based on context it is used
func (m *BaseEntity) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *BaseEntity) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *BaseEntity) UnmarshalBinary(b []byte) error {
var res BaseEntity
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}