modifiers

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Comparators = map[string]Comparator{
	"contains":    contains{},
	"icontains":   icontains{},
	"endswith":    endswith{},
	"iendswith":   iendswith{},
	"startswith":  startswith{},
	"istartswith": istartswith{},
	"gt":          gt{},
	"ge":          ge{},
	"lt":          lt{},
	"le":          le{},
	"fullword":    fullword{},
	"eq":          eq{},
	"iequals":     ieq{},
	"neq":         neq{},
}

Comparators is a map of comparator names to Comparator implementations.

View Source
var ValueModifiers = map[string]ValueModifier{
	"nocase":     &nocase{},
	"ascii":      &ascii{},
	"wide":       &wide{},
	"xor":        &xor{},
	"base64":     &b64{},
	"base64wide": &b64wide{},
}

ValueModifiers is a map of value modifier names to ValueModifier implementations.

View Source
var ValueModifiersWithParameter = map[string]ValueModifierWithParameter{
	"xor":        &xor{},
	"base64":     &b64{},
	"base64wide": &b64wide{},
}

ValueModifiersWithParameter is a map of value modifier names to ValueModifierWithParameter implementations.

Functions

This section is empty.

Types

type Comparator

type Comparator interface {
	Alters(field any, value any) (string, error)
}

Comparator is an interface for comparison operations.

type ComparatorFunc

type ComparatorFunc func(field, value any) (string, error)

ComparatorFunc is a function signature for comparators.

func GetComparator

func GetComparator(modifiers ...string) (ComparatorFunc, error)

GetComparator returns a ComparatorFunc based on the provided modifiers.

type ModifierFunc

type ModifierFunc func(value any) (any, error)

ModifierFunc is a function signature for modifying the expected value.

type ModifierFuncWithParameter

type ModifierFuncWithParameter func(value any, parameter string) (any, error)

ModifierFuncWithParameter is a function signature for modifying the expected value with a parameter.

type ValueModifier

type ValueModifier interface {
	Modify(value any) (any, error)
}

ValueModifier is an interface for modifying the expected value before it is passed to the comparator.

type ValueModifierWithParameter

type ValueModifierWithParameter interface {
	ModifyWithParameter(value any, parameter string) (any, error)
}

ValueModifierWithParameter is an interface for modifying the expected value before it is passed to the comparator, and it can also take a parameter.

Jump to

Keyboard shortcuts

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