62 lines
1.2 KiB
Go
62 lines
1.2 KiB
Go
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
package api
|
|
|
|
import (
|
|
"github.com/go-faster/errors"
|
|
|
|
"github.com/ogen-go/ogen/validate"
|
|
)
|
|
|
|
func (s *Pagination) Validate() error {
|
|
if s == nil {
|
|
return validate.ErrNilPointer
|
|
}
|
|
|
|
var failures []validate.FieldError
|
|
if err := func() error {
|
|
if err := (validate.Int{
|
|
MinSet: true,
|
|
Min: 1,
|
|
MaxSet: false,
|
|
Max: 0,
|
|
MinExclusive: false,
|
|
MaxExclusive: false,
|
|
MultipleOfSet: false,
|
|
MultipleOf: 0,
|
|
}).Validate(int64(s.Page)); err != nil {
|
|
return errors.Wrap(err, "int")
|
|
}
|
|
return nil
|
|
}(); err != nil {
|
|
failures = append(failures, validate.FieldError{
|
|
Name: "Page",
|
|
Error: err,
|
|
})
|
|
}
|
|
if err := func() error {
|
|
if err := (validate.Int{
|
|
MinSet: true,
|
|
Min: 1,
|
|
MaxSet: true,
|
|
Max: 100,
|
|
MinExclusive: false,
|
|
MaxExclusive: false,
|
|
MultipleOfSet: false,
|
|
MultipleOf: 0,
|
|
}).Validate(int64(s.Limit)); err != nil {
|
|
return errors.Wrap(err, "int")
|
|
}
|
|
return nil
|
|
}(); err != nil {
|
|
failures = append(failures, validate.FieldError{
|
|
Name: "Limit",
|
|
Error: err,
|
|
})
|
|
}
|
|
if len(failures) > 0 {
|
|
return &validate.Error{Fields: failures}
|
|
}
|
|
return nil
|
|
}
|