Documentation
¶
Index ¶
- type BoolSchema
- type DateTimeSchema
- func (s *DateTimeSchema) EpochUnit(interval EpochUnit) *DateTimeSchema
- func (s *DateTimeSchema) Layout(layout string) *DateTimeSchema
- func (s *DateTimeSchema) ToSchema() *ogen.Schema
- func (s *DateTimeSchema) Validate(v any, _ SchemaValidationFlag) (out time.Time, e error)
- func (s *DateTimeSchema) ValidateGeneric(v any, flags SchemaValidationFlag) (any, error)
- type EpochUnit
- type NumSchema
- func Float32(err string) *NumSchema[float32]
- func Float64(err string) *NumSchema[float64]
- func Int(err string) *NumSchema[int]
- func Int8(err string) *NumSchema[int8]
- func Int16(err string) *NumSchema[int16]
- func Int32(err string) *NumSchema[int32]
- func Int64(err string) *NumSchema[int64]
- func Uint8(err string) *NumSchema[uint8]
- func Uint16(err string) *NumSchema[uint16]
- func Uint32(err string) *NumSchema[uint32]
- func (s *NumSchema[T]) Max(val int64, exclusive bool, err string) *NumSchema[T]
- func (s *NumSchema[T]) Min(val int64, exclusive bool, err string) *NumSchema[T]
- func (s *NumSchema[T]) ToSchema() (os *ogen.Schema)
- func (s *NumSchema[T]) Validate(v any, flags SchemaValidationFlag) (out T, e error)
- func (s *NumSchema[T]) ValidateGeneric(v any, flags SchemaValidationFlag) (any, error)
- type Schema
- type SchemaTrait
- type SchemaValidationFlag
- type StringSchema
- func (s *StringSchema) MaxLen(l uint64, err string) *StringSchema
- func (s *StringSchema) MinLen(l uint64, err string) *StringSchema
- func (s *StringSchema) Pattern(p string, err string) *StringSchema
- func (s *StringSchema) ToSchema() (os *ogen.Schema)
- func (s *StringSchema) Validate(v any, flags SchemaValidationFlag) (out string, e error)
- func (s *StringSchema) ValidateGeneric(v any, flags SchemaValidationFlag) (any, error)
- type StructCompileError
- type StructFieldFlag
- type StructSchema
- func (s *StructSchema[T]) AddField(name string, schema SchemaTrait, flags StructFieldFlag) *StructSchema[T]
- func (s *StructSchema[T]) ToSchema() (os *ogen.Schema)
- func (s *StructSchema[T]) Validate(m any, flags SchemaValidationFlag) (out T, e error)
- func (s *StructSchema[T]) ValidateGeneric(v any, flags SchemaValidationFlag) (any, error)
- type UUIDSchema
- type ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoolSchema ¶
type BoolSchema struct {
// contains filtered or unexported fields
}
func Bool ¶
func Bool(err string) *BoolSchema
func (*BoolSchema) ToSchema ¶
func (s *BoolSchema) ToSchema() *ogen.Schema
func (*BoolSchema) Validate ¶
func (s *BoolSchema) Validate(v any, _ SchemaValidationFlag) (out bool, e error)
func (*BoolSchema) ValidateGeneric ¶
func (s *BoolSchema) ValidateGeneric(v any, flags SchemaValidationFlag) (any, error)
type DateTimeSchema ¶
type DateTimeSchema struct {
// contains filtered or unexported fields
}
func DateTime ¶
func DateTime(err string) *DateTimeSchema
func (*DateTimeSchema) EpochUnit ¶
func (s *DateTimeSchema) EpochUnit(interval EpochUnit) *DateTimeSchema
func (*DateTimeSchema) Layout ¶
func (s *DateTimeSchema) Layout(layout string) *DateTimeSchema
func (*DateTimeSchema) ToSchema ¶
func (s *DateTimeSchema) ToSchema() *ogen.Schema
func (*DateTimeSchema) Validate ¶
func (s *DateTimeSchema) Validate(v any, _ SchemaValidationFlag) (out time.Time, e error)
func (*DateTimeSchema) ValidateGeneric ¶
func (s *DateTimeSchema) ValidateGeneric(v any, flags SchemaValidationFlag) (any, error)
type NumSchema ¶
type NumSchema[T integer | float] struct {
// contains filtered or unexported fields
}
type SchemaTrait ¶
type SchemaValidationFlag ¶
type SchemaValidationFlag uint8
const (
AbortEarly SchemaValidationFlag = 1 << iota
)
type StringSchema ¶
type StringSchema struct {
// contains filtered or unexported fields
}
func String ¶
func String(err string) *StringSchema
func (*StringSchema) MaxLen ¶
func (s *StringSchema) MaxLen(l uint64, err string) *StringSchema
func (*StringSchema) MinLen ¶
func (s *StringSchema) MinLen(l uint64, err string) *StringSchema
func (*StringSchema) Pattern ¶
func (s *StringSchema) Pattern(p string, err string) *StringSchema
func (*StringSchema) ToSchema ¶
func (s *StringSchema) ToSchema() (os *ogen.Schema)
func (*StringSchema) Validate ¶
func (s *StringSchema) Validate(v any, flags SchemaValidationFlag) (out string, e error)
func (*StringSchema) ValidateGeneric ¶
func (s *StringSchema) ValidateGeneric(v any, flags SchemaValidationFlag) (any, error)
type StructCompileError ¶
type StructFieldFlag ¶
type StructFieldFlag uint8
const (
FieldRequired StructFieldFlag = 1 << iota
)
type StructSchema ¶
type StructSchema[T any] struct { // contains filtered or unexported fields }
func StructFor ¶
func StructFor[T any](err string) *StructSchema[T]
func StructForE ¶
func StructForE[T any](err string) (*StructSchema[T], error)
func (*StructSchema[T]) AddField ¶
func (s *StructSchema[T]) AddField(name string, schema SchemaTrait, flags StructFieldFlag) *StructSchema[T]
func (*StructSchema[T]) ToSchema ¶
func (s *StructSchema[T]) ToSchema() (os *ogen.Schema)
func (*StructSchema[T]) Validate ¶
func (s *StructSchema[T]) Validate(m any, flags SchemaValidationFlag) (out T, e error)
func (*StructSchema[T]) ValidateGeneric ¶
func (s *StructSchema[T]) ValidateGeneric(v any, flags SchemaValidationFlag) (any, error)
type UUIDSchema ¶
type UUIDSchema struct {
// contains filtered or unexported fields
}
func UUID ¶
func UUID(err string) *UUIDSchema
func (*UUIDSchema) ToSchema ¶
func (s *UUIDSchema) ToSchema() *ogen.Schema
func (*UUIDSchema) Validate ¶
func (s *UUIDSchema) Validate(v any, _ SchemaValidationFlag) (out uuid.UUID, e error)
func (*UUIDSchema) ValidateGeneric ¶
func (s *UUIDSchema) ValidateGeneric(v any, flags SchemaValidationFlag) (any, error)
type ValidationError ¶
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.