You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
1.6 KiB
83 lines
1.6 KiB
// 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"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/strfmt"
|
|
"github.com/go-openapi/swag"
|
|
)
|
|
|
|
// CreditHistory credit history
|
|
//
|
|
// swagger:model CreditHistory
|
|
type CreditHistory struct {
|
|
|
|
// account ID
|
|
AccountID string `json:"AccountID,omitempty" gorm:"primary_key"`
|
|
|
|
// events
|
|
Events []*Event `json:"Events"`
|
|
}
|
|
|
|
// Validate validates this credit history
|
|
func (m *CreditHistory) Validate(formats strfmt.Registry) error {
|
|
var res []error
|
|
|
|
if err := m.validateEvents(formats); err != nil {
|
|
res = append(res, err)
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (m *CreditHistory) validateEvents(formats strfmt.Registry) error {
|
|
|
|
if swag.IsZero(m.Events) { // not required
|
|
return nil
|
|
}
|
|
|
|
for i := 0; i < len(m.Events); i++ {
|
|
if swag.IsZero(m.Events[i]) { // not required
|
|
continue
|
|
}
|
|
|
|
if m.Events[i] != nil {
|
|
if err := m.Events[i].Validate(formats); err != nil {
|
|
if ve, ok := err.(*errors.Validation); ok {
|
|
return ve.ValidateName("Events" + "." + strconv.Itoa(i))
|
|
}
|
|
return err
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
return nil
|
|
}
|
|
|
|
// MarshalBinary interface implementation
|
|
func (m *CreditHistory) MarshalBinary() ([]byte, error) {
|
|
if m == nil {
|
|
return nil, nil
|
|
}
|
|
return swag.WriteJSON(m)
|
|
}
|
|
|
|
// UnmarshalBinary interface implementation
|
|
func (m *CreditHistory) UnmarshalBinary(b []byte) error {
|
|
var res CreditHistory
|
|
if err := swag.ReadJSON(b, &res); err != nil {
|
|
return err
|
|
}
|
|
*m = res
|
|
return nil
|
|
}
|
|
|