filters

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: BSD-3-Clause Imports: 5 Imported by: 7

Documentation

Overview

Packge filters defines interfaces for filtering documents which should be processed during an iteration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filters

type Filters interface {
	// Apply() performs any filtering operations defined by the interface implementation to an `io.ReadSeekCloser` instance and returns a boolean value indicating whether the record should be considered for further processing.
	Apply(context.Context, io.ReadSeeker) (bool, error)
}

type Filters defines an interface for filtering documents which should be processed during an iteration.

func NewQueryFiltersFromQuery

func NewQueryFiltersFromQuery(ctx context.Context, q url.Values) (Filters, error)

NewQueryFiltersFromQuery() will return a `QueryFilters` instance derived from 'q' which is expected to contain zero or more of the following parameters: * `?include=` Zero or more `aaronland/go-json-query` query strings containing rules that must match for a document to be considered for further processing. * `?exclude=` Zero or more `aaronland/go-json-query` query strings containing rules that if matched will prevent a document from being considered for further processing. * `?include_mode=` A valid `aaronland/go-json-query` query mode string for testing inclusion rules. * `?exclude_mode=` A valid `aaronland/go-json-query` query mode string for testing exclusion rules.

func NewQueryFiltersFromURI

func NewQueryFiltersFromURI(ctx context.Context, uri string) (Filters, error)

NewQueryFiltersFromURI() will return a `QueryFilters` instance derived from 'uri' which is expected to take the form of:

{SCHEME}://{HOST}?{PARAMETERS}

Where {SCHEME} and {HOST} can be any value so long as they conform to the URI standard. {PARAMETERS} is expected to be zero or more of the following parameters: * `?include=` Zero or more `aaronland/go-json-query` query strings containing rules that must match for a document to be considered for further processing. * `?exclude=` Zero or more `aaronland/go-json-query` query strings containing rules that if matched will prevent a document from being considered for further processing. * `?include_mode=` A valid `aaronland/go-json-query` query mode string for testing inclusion rules. * `?exclude_mode=` A valid `aaronland/go-json-query` query mode string for testing exclusion rules.

type QueryFilters

type QueryFilters struct {
	Filters
	// Include is a `aaronland/go-json-query.QuerySet` instance containing rules that must match for a document to be considered for further processing.
	Include *query.QuerySet
	// Exclude is a `aaronland/go-json-query.QuerySet` instance containing rules that if matched will prevent a document from being considered for further processing.
	Exclude *query.QuerySet
}

type QueryFilters implements the `Filters` interface for filtering documents using `aaronland/go-json-query` query strings.

func (*QueryFilters) Apply

func (f *QueryFilters) Apply(ctx context.Context, fh io.ReadSeeker) (bool, error)

Apply() performs filtering operations against 'fh' and returns a boolean value indicating whether the record should be considered for further processing.

Jump to

Keyboard shortcuts

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