peridot/vendor/github.com/ory/hydra-client-go/models/null_time.go
2022-07-07 22:13:21 +02:00

67 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 (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// NullTime NullTime implements sql.NullTime functionality.
//
// swagger:model nullTime
type NullTime strfmt.DateTime
// UnmarshalJSON sets a NullTime value from JSON input
func (m *NullTime) UnmarshalJSON(b []byte) error {
return ((*strfmt.DateTime)(m)).UnmarshalJSON(b)
}
// MarshalJSON retrieves a NullTime value as JSON output
func (m NullTime) MarshalJSON() ([]byte, error) {
return (strfmt.DateTime(m)).MarshalJSON()
}
// Validate validates this null time
func (m NullTime) Validate(formats strfmt.Registry) error {
var res []error
if err := validate.FormatOf("", "body", "date-time", strfmt.DateTime(m).String(), formats); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
// ContextValidate validates this null time based on context it is used
func (m NullTime) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *NullTime) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *NullTime) UnmarshalBinary(b []byte) error {
var res NullTime
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}