Documentation
¶
Index ¶
- type ArraySchema
- type BoolSchema
- type Float64Schema
- func (s *Float64Schema) Gt(min float64) *Float64Schema
- func (s *Float64Schema) Gte(min float64) *Float64Schema
- func (s *Float64Schema) Lt(min float64) *Float64Schema
- func (s *Float64Schema) Lte(min float64) *Float64Schema
- func (s *Float64Schema) MultipleOf(multiple float64) *Float64Schema
- func (s *Float64Schema) Negative() *Float64Schema
- func (s *Float64Schema) Nonnegative() *Float64Schema
- func (s *Float64Schema) Nonpositive() *Float64Schema
- func (s *Float64Schema) Positive() *Float64Schema
- type ISchema
- type IntSchema
- func (s *IntSchema) Gt(min int) *IntSchema
- func (s *IntSchema) Gte(min int) *IntSchema
- func (s *IntSchema) Lt(min int) *IntSchema
- func (s *IntSchema) Lte(min int) *IntSchema
- func (s *IntSchema) MultipleOf(multiple int) *IntSchema
- func (s *IntSchema) Negative() *IntSchema
- func (s *IntSchema) Nonnegative() *IntSchema
- func (s *IntSchema) Nonpositive() *IntSchema
- func (s *IntSchema) Positive() *IntSchema
- type LiteralSchema
- type ObjectSchema
- type Schema
- type StringSchema
- func (s *StringSchema) EndsWith(str string) *StringSchema
- func (s *StringSchema) Includes(str string) *StringSchema
- func (s *StringSchema) Length(length int) *StringSchema
- func (s *StringSchema) Max(maxLength int) *StringSchema
- func (s *StringSchema) Min(minLength int) *StringSchema
- func (s *StringSchema) StartsWith(str string) *StringSchema
- func (s *StringSchema) Url() *StringSchema
- type TimeSchema
- type UUIDSchema
- type ValidationError
- type ValidationResult
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ArraySchema ¶ added in v0.3.0
type ArraySchema struct { Schema[[]interface{}] // contains filtered or unexported fields }
func Array ¶ added in v0.3.0
func Array(s ISchema) *ArraySchema
func (*ArraySchema) Max ¶ added in v0.3.0
func (s *ArraySchema) Max(maxLength int) *ArraySchema
func (*ArraySchema) Min ¶ added in v0.3.0
func (s *ArraySchema) Min(minLength int) *ArraySchema
func (*ArraySchema) Parse ¶ added in v0.3.0
func (s *ArraySchema) Parse(value any) *ValidationResult
type Float64Schema ¶ added in v0.4.0
func Float64 ¶ added in v0.4.0
func Float64() *Float64Schema
func (*Float64Schema) Gt ¶ added in v0.4.0
func (s *Float64Schema) Gt(min float64) *Float64Schema
func (*Float64Schema) Gte ¶ added in v0.4.0
func (s *Float64Schema) Gte(min float64) *Float64Schema
func (*Float64Schema) Lt ¶ added in v0.4.0
func (s *Float64Schema) Lt(min float64) *Float64Schema
func (*Float64Schema) Lte ¶ added in v0.4.0
func (s *Float64Schema) Lte(min float64) *Float64Schema
func (*Float64Schema) MultipleOf ¶ added in v0.4.0
func (s *Float64Schema) MultipleOf(multiple float64) *Float64Schema
func (*Float64Schema) Negative ¶ added in v0.4.0
func (s *Float64Schema) Negative() *Float64Schema
func (*Float64Schema) Nonnegative ¶ added in v0.4.0
func (s *Float64Schema) Nonnegative() *Float64Schema
func (*Float64Schema) Nonpositive ¶ added in v0.4.0
func (s *Float64Schema) Nonpositive() *Float64Schema
func (*Float64Schema) Positive ¶ added in v0.4.0
func (s *Float64Schema) Positive() *Float64Schema
type ISchema ¶
type ISchema interface {
Parse(value any) *ValidationResult
}
type IntSchema ¶
func (*IntSchema) MultipleOf ¶
func (*IntSchema) Nonnegative ¶
func (*IntSchema) Nonpositive ¶
type LiteralSchema ¶ added in v0.2.0
func Literal ¶ added in v0.2.0
func Literal[T any](value T) *LiteralSchema[T]
type ObjectSchema ¶
type ObjectSchema struct { Schema[map[string]interface{}] // contains filtered or unexported fields }
func Object ¶
func Object(obj map[string]ISchema) *ObjectSchema
func (*ObjectSchema) Parse ¶
func (s *ObjectSchema) Parse(value any) *ValidationResult
func (*ObjectSchema) Refine ¶
func (s *ObjectSchema) Refine(predicate func(map[string]interface{}) bool) *ObjectSchema
type Schema ¶
type Schema[T any] struct { // contains filtered or unexported fields }
func (*Schema[T]) Parse ¶
func (s *Schema[T]) Parse(value any) *ValidationResult
type StringSchema ¶
func String ¶
func String() *StringSchema
func (*StringSchema) EndsWith ¶
func (s *StringSchema) EndsWith(str string) *StringSchema
func (*StringSchema) Includes ¶
func (s *StringSchema) Includes(str string) *StringSchema
func (*StringSchema) Length ¶
func (s *StringSchema) Length(length int) *StringSchema
func (*StringSchema) Max ¶
func (s *StringSchema) Max(maxLength int) *StringSchema
func (*StringSchema) Min ¶
func (s *StringSchema) Min(minLength int) *StringSchema
func (*StringSchema) StartsWith ¶
func (s *StringSchema) StartsWith(str string) *StringSchema
func (*StringSchema) Url ¶
func (s *StringSchema) Url() *StringSchema
type TimeSchema ¶ added in v0.5.0
func Time ¶ added in v0.5.0
func Time() *TimeSchema
type UUIDSchema ¶ added in v0.2.0
func UUID ¶ added in v0.2.0
func UUID() *UUIDSchema
type ValidationError ¶
func (*ValidationError) Error ¶
func (m *ValidationError) Error() string
type ValidationResult ¶
type ValidationResult struct {
Errors []ValidationError
}
func (*ValidationResult) IsValid ¶
func (v *ValidationResult) IsValid() bool
Source Files
¶
Click to show internal directories.
Click to hide internal directories.