/
rain
/
google-auth-bot
Обзор
Документация
Войти
/
rain
/
google-auth-bot
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
dev
internal/telegram-bot/apiClient/models/orm_user.go
184 строки
4 KB
Kirill
mvp telegram bot and some improvements for api
11 мар 2024, 00:54
11 мар 2024, 00:54
caa6f37
Код
Авторство
О чём код?
// 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" "strconv" "github.com/go-openapi/errors" "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // OrmUser orm user // // swagger:model orm.User type OrmUser struct { // created at CreatedAt string `json:"createdAt,omitempty"` // deleted at DeletedAt *GormDeletedAt `json:"deletedAt,omitempty"` // id ID int64 `json:"id,omitempty"` // languageiso Languageiso string `json:"languageiso,omitempty"` // totps Totps []*OrmToTP `json:"totps"` // updated at UpdatedAt string `json:"updatedAt,omitempty"` } // Validate validates this orm user func (m *OrmUser) Validate(formats strfmt.Registry) error { var res []error if err := m.validateDeletedAt(formats); err != nil { res = append(res, err) } if err := m.validateTotps(formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *OrmUser) validateDeletedAt(formats strfmt.Registry) error { if swag.IsZero(m.DeletedAt) { // not required return nil } if m.DeletedAt != nil { if err := m.DeletedAt.Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("deletedAt") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("deletedAt") } return err } } return nil } func (m *OrmUser) validateTotps(formats strfmt.Registry) error { if swag.IsZero(m.Totps) { // not required return nil } for i := 0; i < len(m.Totps); i++ { if swag.IsZero(m.Totps[i]) { // not required continue } if m.Totps[i] != nil { if err := m.Totps[i].Validate(formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("totps" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("totps" + "." + strconv.Itoa(i)) } return err } } } return nil } // ContextValidate validate this orm user based on the context it is used func (m *OrmUser) ContextValidate(ctx context.Context, formats strfmt.Registry) error { var res []error if err := m.contextValidateDeletedAt(ctx, formats); err != nil { res = append(res, err) } if err := m.contextValidateTotps(ctx, formats); err != nil { res = append(res, err) } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } func (m *OrmUser) contextValidateDeletedAt(ctx context.Context, formats strfmt.Registry) error { if m.DeletedAt != nil { if swag.IsZero(m.DeletedAt) { // not required return nil } if err := m.DeletedAt.ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("deletedAt") } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("deletedAt") } return err } } return nil } func (m *OrmUser) contextValidateTotps(ctx context.Context, formats strfmt.Registry) error { for i := 0; i < len(m.Totps); i++ { if m.Totps[i] != nil { if swag.IsZero(m.Totps[i]) { // not required return nil } if err := m.Totps[i].ContextValidate(ctx, formats); err != nil { if ve, ok := err.(*errors.Validation); ok { return ve.ValidateName("totps" + "." + strconv.Itoa(i)) } else if ce, ok := err.(*errors.CompositeError); ok { return ce.ValidateName("totps" + "." + strconv.Itoa(i)) } return err } } } return nil } // MarshalBinary interface implementation func (m *OrmUser) MarshalBinary() ([]byte, error) { if m == nil { return nil, nil } return swag.WriteJSON(m) } // UnmarshalBinary interface implementation func (m *OrmUser) UnmarshalBinary(b []byte) error { var res OrmUser if err := swag.ReadJSON(b, &res); err != nil { return err } *m = res return nil }