ruleset

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

internal/ruleset/rule.go

internal/ruleset/set.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply[T any](value T, reporter Reporter, rules ...RuleFn[T]) bool

Types

type ApplyFunction

type ApplyFunction[T any] func(value T, context *engine.Context) (T, bool)

type Reporter

type Reporter interface {
	AddIssue(code string, message string) bool
	AddIssueWithMeta(code string, message string, meta map[string]any) bool
}

type Rule

type Rule[T any] struct {
	Key   string
	Apply ApplyFunction[T]
}

func New

func New[T any](key string, apply ApplyFunction[T]) Rule[T]

type RuleFn

type RuleFn[T any] func(value T, reporter Reporter) bool

type Set

type Set[T any] struct {
	// contains filtered or unexported fields
}

func NewSet

func NewSet[T any]() *Set[T]

func (*Set[T]) ApplyAll

func (set *Set[T]) ApplyAll(value T, context *engine.Context) (T, bool)

func (*Set[T]) Put

func (set *Set[T]) Put(ruleValue Rule[T])

func (*Set[T]) Remove

func (set *Set[T]) Remove(key string)

Jump to

Keyboard shortcuts

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