// 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" ) // User user // // swagger:model User type User struct { // account number // Max Length: 30 AccountNumber string `json:"accountNumber,omitempty"` // The user alias will be displayed in the frontend instead of the username // Max Length: 60 Alias string `json:"alias,omitempty"` // The assigned color in HTML hex format, eg. #dd1d00 Color string `json:"color,omitempty"` // enabled Enabled bool `json:"enabled,omitempty"` // Internal ID ID int64 `json:"id,omitempty"` // username // Required: true // Max Length: 60 // Min Length: 2 Username *string `json:"username"` } // Validate validates this user func (m *User) Validate(formats strfmt.Registry) error { var res []error if err := m.validateAccountNumber(formats); err != nil { res = append(res, err) } if err := m.validateAlias(formats); err != nil { res = append(res, err) } if err := m.validateUsername(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *User) validateAccountNumber(formats strfmt.Registry) error { if swag.IsZero(m.AccountNumber) { // not required return nil } if err := validate.MaxLength("accountNumber", "body", m.AccountNumber, 30); err != nil { return err } return nil } func (m *User) validateAlias(formats strfmt.Registry) error { if swag.IsZero(m.Alias) { // not required return nil } if err := validate.MaxLength("alias", "body", m.Alias, 60); err != nil { return err } return nil } func (m *User) validateUsername(formats strfmt.Registry) error { if err := validate.Required("username", "body", m.Username); err != nil { return err } if err := validate.MinLength("username", "body", *m.Username, 2); err != nil { return err } if err := validate.MaxLength("username", "body", *m.Username, 60); err != nil { return err } return nil } // ContextValidate validates this user based on context it is used func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { return nil } // MarshalBinary interface implementation func (m *User) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *User) UnmarshalBinary(b []byte) error { var res User if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }