expr

package
v0.0.0-...-9b93ea0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultQualifier = "v"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LeafValidator

type LeafValidator struct {
	Name string
	Args []string
	Msg  string

	Param Param
	Decls []*decl.Validator
}

LeafValidator is an expression that represents a leaf validator.

func (*LeafValidator) Bind

func (v *LeafValidator) Bind(param Param, decls map[string][]*decl.Validator) error

func (*LeafValidator) ExprString

func (v *LeafValidator) ExprString() string

type LogicValidator

type LogicValidator struct {
	Qualifier string
	Name      string
	Left      Validator
	Right     Validator // `Not` has no Right validator.
}

LogicValidator is an expression that represents a logic validator (i.e. `Not`, `And/All` or `Or/Any`).

func (*LogicValidator) Bind

func (v *LogicValidator) Bind(param Param, decls map[string][]*decl.Validator) error

func (*LogicValidator) ExprString

func (v *LogicValidator) ExprString() string

type Param

type Param struct {
	Name string
	Type types.Type
}

type Parser

type Parser struct {
	S string
}

func (Parser) Parse

func (p Parser) Parse(e ast.Expr) (Validator, error)

type Validator

type Validator interface {
	Bind(param Param, decls map[string][]*decl.Validator) error

	// ExprString returns the validating-style expression string.
	ExprString() string
}

func Parse

func Parse(s string) (Validator, error)

Jump to

Keyboard shortcuts

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