expression

package
v1.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TypeMap = map[Type]interface{}{
	Regex:            struct{}{},
	LessThan:         struct{}{},
	LessThanEqual:    struct{}{},
	GreaterThan:      struct{}{},
	GreaterThanEqual: struct{}{},
	EqualTo:          struct{}{},
	NotEqualTo:       struct{}{},
}

TypeMap contains all the expression types for validation.

Functions

This section is empty.

Types

type Expression

type Expression interface {
	Match(input interface{}) (bool, error)
}

Expression the expression interface

func MakeExpression

func MakeExpression(expressionType Type, expressionSearchStr string, target interface{}) (exp Expression, err error)

MakeExpression creates an expression based on an expression type

type Type

type Type string

Type is the type of the filter (i.e. const, regex, etc)

const (
	// EqualTo a filter that applies numerical and string equal to operations
	EqualTo Type = "equal"
	// Regex a filter that applies regex rules to the matching
	Regex Type = "regex"

	// LessThan a filter that applies numerical less than operation
	LessThan Type = "less-than"
	// LessThanEqual a filter that applies numerical less than or equal operation
	LessThanEqual Type = "less-than-equal"
	// GreaterThan a filter that applies numerical greater than operation
	GreaterThan Type = "greater-than"
	// GreaterThanEqual a filter that applies numerical greater than or equal operation
	GreaterThanEqual Type = "greater-than-equal"
	// NotEqualTo a filter that applies numerical NOT equal to operation
	NotEqualTo Type = "not-equal"
)

Jump to

Keyboard shortcuts

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