store

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2019 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RulesetPutEvent = "PUT"
)

List of possible events executed against a ruleset.

Variables

View Source
var (
	ErrNotFound             = errors.New("not found")
	ErrNotModified          = errors.New("not modified")
	ErrInvalidContinueToken = errors.New("invalid continue token")
)

Common errors.

Functions

func IsValidationError

func IsValidationError(err error) bool

IsValidationError indicates if the given error is a ValidationError pointer.

Types

type RulesetEntries

type RulesetEntries struct {
	Entries  []RulesetEntry
	Revision string // revision when the request was applied
	Continue string // token of the next page, if any
}

RulesetEntries holds a list of ruleset entries.

type RulesetEntry

type RulesetEntry struct {
	Path    string
	Version string
	Ruleset *regula.Ruleset
}

RulesetEntry holds a ruleset and its metadata.

type RulesetEvent

type RulesetEvent struct {
	Type    string
	Path    string
	Version string
	Ruleset *regula.Ruleset
}

RulesetEvent describes an event that occured on a ruleset.

type RulesetEvents

type RulesetEvents struct {
	Events   []RulesetEvent
	Revision string
}

RulesetEvents holds a list of events occured on a group of rulesets.

type RulesetService

type RulesetService interface {
	// List returns all the rulesets entries under the given prefix.
	List(ctx context.Context, prefix string, limit int, continueToken string) (*RulesetEntries, error)
	// Latest returns the latest version of the ruleset entry which corresponds to the given path.
	Latest(ctx context.Context, path string) (*RulesetEntry, error)
	// OneByVersion returns the ruleset entry which corresponds to the given path at the given version.
	OneByVersion(ctx context.Context, path, version string) (*RulesetEntry, error)
	// Watch a prefix for changes and return a list of events.
	Watch(ctx context.Context, prefix string, revision string) (*RulesetEvents, error)
	// Put is used to store a ruleset version.
	Put(ctx context.Context, path string, ruleset *regula.Ruleset) (*RulesetEntry, error)
	// Eval evaluates a ruleset given a path and a set of parameters. It implements the regula.Evaluator interface.
	Eval(ctx context.Context, path string, params rule.Params) (*regula.EvalResult, error)
	// EvalVersion evaluates a ruleset given a path and a set of parameters. It implements the regula.Evaluator interface.
	EvalVersion(ctx context.Context, path, version string, params rule.Params) (*regula.EvalResult, error)
}

RulesetService manages rulesets.

type ValidationError

type ValidationError struct {
	Field  string
	Value  string
	Reason string
}

ValidationError gives informations about the reason of failed validation.

func (*ValidationError) Error

func (v *ValidationError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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