rules

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2021 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Priority

func Priority(rule *api.Rule, priorityScore int) int

Priority calculates the priority of the rule by scoring it and multiplying by priorityScore

Types

type Engine

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

func (*Engine) Build

func (e *Engine) Build(ctx context.Context, rule *api.Rule, value interface{}, priority ...int) error

func (*Engine) Match

func (e *Engine) Match(ctx context.Context, meta *api.Context) (value interface{}, ok bool)

type MatchFunc

type MatchFunc func(ctx context.Context, meta *api.Context) bool

func (MatchFunc) Match

func (fn MatchFunc) Match(ctx context.Context, meta *api.Context) bool

type Matcher

type Matcher interface {
	Match(ctx context.Context, meta *api.Context) bool
}

type Node

type Node struct {
	Value   interface{}
	Matcher Matcher
	Score   int
}

Jump to

Keyboard shortcuts

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