owl

package module
v1.0.0-beta.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 7 Imported by: 0

README

a zero dependency performant validation library

Rules

Name Description Status
required not nil or zero value
default default value
enum one of a set of options

String

Name Description Status
pattern match regular expression
format match format
min min length
max max length

Numeric

Name Description Status
min minimum
max maximum

Formats

Name Status
date_time
email
ipv4
ipv6
uri
uuid

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFormat

func AddFormat(name string, formatter Formatter) *owl

func AddRule

func AddRule(name string, rule rules.Rule, dependsOn ...string) *owl

func AddTransform

func AddTransform(t reflect.Type, fn Transform) *owl

func New

func New() *owl

Types

type Error

type Error struct {
	Path    string `json:"path"`
	Keyword string `json:"keyword"`
	Message string `json:"message"`
}

func Validate

func Validate(v any) []Error

func (Error) Error

func (self Error) Error() string

type Formatter

type Formatter func(string) error

type Transform

type Transform func(reflect.Value) reflect.Value

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL