define

package
v0.0.0-...-d5737d5 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiDefine

type ApiDefine struct {
	// contains filtered or unexported fields
}

func New

func New() *ApiDefine

func (*ApiDefine) BaseOut

func (d *ApiDefine) BaseOut()

func (*ApiDefine) In

func (d *ApiDefine) In(name string, desc string) *Param

func (*ApiDefine) Out

func (d *ApiDefine) Out(name string, desc string) *Param

func (*ApiDefine) Validate

func (d *ApiDefine) Validate(u url.Values) error

func (*ApiDefine) ValidateRequest

func (d *ApiDefine) ValidateRequest(req *http.Request) func(w http.ResponseWriter)

type Errors

type Errors url.Values

func (Errors) Add

func (errs Errors) Add(name string, message string)

func (Errors) Error

func (errs Errors) Error() string

func (Errors) IsEmpty

func (errs Errors) IsEmpty() bool

func (Errors) Set

func (errs Errors) Set(name string, message ...string)

func (Errors) String

func (errs Errors) String() string

type Param

type Param struct {
	// contains filtered or unexported fields
}

func (*Param) Add

func (p *Param) Add(vs ...Validator) *Param

func (*Param) Require

func (p *Param) Require() *Param

func (*Param) RequireMessage

func (p *Param) RequireMessage(msg string) *Param

type VFunc

type VFunc func(value string) error

func Bool

func Bool(message string) VFunc

func Float

func Float(message string) VFunc

func Int

func Int(message string) VFunc

func Length

func Length(min, max int, message string) VFunc

func Range

func Range(min, max int64, message string) VFunc

func Regex

func Regex(pattern string, message string) VFunc

func (VFunc) Exec

func (v VFunc) Exec(value string) error

type Validator

type Validator interface {
	Exec(value string) error
}

Jump to

Keyboard shortcuts

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