expr

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeString = "string"
	TypeNumber = "number"
	TypeBool   = "bool"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyExpr

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

func (*AnyExpr) Eval

func (e *AnyExpr) Eval(r mirror.Request) (interface{}, error)

func (*AnyExpr) Static

func (e *AnyExpr) Static() bool

func (*AnyExpr) UnmarshalJSON

func (e *AnyExpr) UnmarshalJSON(b []byte) error

type BoolExpr

type BoolExpr struct {
	AnyExpr
}

func (*BoolExpr) Eval

func (e *BoolExpr) Eval(r mirror.Request) (bool, error)

func (*BoolExpr) UnmarshalJSON

func (e *BoolExpr) UnmarshalJSON(b []byte) error

type Expr

type Expr interface {
	Type() Type
	Eval(mirror.Request) (interface{}, error)
	Static() bool
}

func Parse

func Parse(str string) (Expr, error)

func ParseTmpl

func ParseTmpl(str string) (Expr, error)

type NumberExpr

type NumberExpr struct {
	AnyExpr
}

func (*NumberExpr) EvalFloat

func (e *NumberExpr) EvalFloat(r mirror.Request) (float64, error)

func (*NumberExpr) EvalInt

func (e *NumberExpr) EvalInt(r mirror.Request) (int, error)

func (*NumberExpr) UnmarshalJSON

func (e *NumberExpr) UnmarshalJSON(b []byte) error

type StringExpr

type StringExpr struct {
	AnyExpr
}

func (*StringExpr) Eval

func (e *StringExpr) Eval(r mirror.Request) (string, error)

func (*StringExpr) UnmarshalJSON

func (e *StringExpr) UnmarshalJSON(b []byte) error

type Type

type Type string

Jump to

Keyboard shortcuts

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