validator

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: MIT, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Messages Messages
}

type Errors

type Errors map[string][]string

type Messages

type Messages struct {
	Email     string `json:"email" toml:"email" yaml:"email"`
	Required  string `json:"required" toml:"required" yaml:"required"`
	MinText   string `json:"minText" toml:"minText" yaml:"minText"`
	MaxText   string `json:"maxText" toml:"maxText" yaml:"maxText"`
	MinNumber string `json:"minNumber" toml:"minNumber" yaml:"minNumber"`
	MaxNumber string `json:"maxNumber" toml:"maxNumber" yaml:"maxNumber"`
}

type Schema

type Schema interface {
	Add(name string) SchemaField
}

func Shape

func Shape() Schema

type SchemaField

type SchemaField interface {
	Email() SchemaField
	Required() SchemaField
	Min(min int) SchemaField
	Max(max int) SchemaField
}

func Field

func Field() SchemaField

type Validator

type Validator interface {
	Json(s Schema, data any) (bool, Errors)
}

func New

func New(config ...Config) Validator

Jump to

Keyboard shortcuts

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