filter

package
v0.0.0-...-204d889 Latest Latest
Warning

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

Go to latest
Published: May 4, 2019 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package filter implements a collections of matchers for accepting or rejecting messages based on some simple structural rules.

  1. Partial-Literal matching The main mode of operation is to match specified literals, so if we get the filter expression like: {"foo": "bar"} then it will match maps with that shape. e.g. {"foo": "bar", "baz": true} Note that this can only prefix-match arrays, see [anything].
  1. Exact-Literal matching This would kick in when we are passed a pattern with the shape: {"[exact]": {"foo": "bar"}} The result would be something very similar to #1, however, we would not accept the unspecified "baz" key. This applies to exactly one level of the object.
  1. One Of matching This would kick in when we are passed a pattern with the shape: {"[oneof]": [{"foo": "bar"}, {"baz": "blah"}]}
  1. Match Anything This would kick in when we are passed a pattern with the shape: [anything] The idea is to allow folks to blank out values in partial literal matching of arrays, or require a key without specifying the value. e.g. {"foo": ["bar", "[anything]", "baz"]} e.g. {"foo": "[anything]"}

5. TODO(mattmoor): Regexp Match

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

type Matcher interface {
	Match(interface{}) bool
}

func Compile

func Compile(pattern interface{}) (Matcher, error)

Jump to

Keyboard shortcuts

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