query

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllFilter

type AllFilter struct{}

AllFilter matches everything

func (*AllFilter) Apply

func (f *AllFilter) Apply(objects map[string]spdx.Object) (map[string]spdx.Object, error)

type DepthFilter

type DepthFilter struct {
	TargetDepth int
}

func (*DepthFilter) Apply

func (f *DepthFilter) Apply(objects map[string]spdx.Object) (map[string]spdx.Object, error)

type Engine

type Engine struct {
	Document *spdx.Document
	MaxDepth int
	// contains filtered or unexported fields
}

func New

func New() *Engine

func (*Engine) Open

func (e *Engine) Open(path string) error

Open reads a document from the specified path

func (*Engine) Query

func (e *Engine) Query(expString string) (fr FilterResults, err error)

Query takes an expression as a string and filters the loaded document

type Expression

type Expression struct {
	Filters []Filter
}

func NewExpression

func NewExpression(exp string) (*Expression, error)

type Filter

type Filter interface {
	Apply(map[string]spdx.Object) (map[string]spdx.Object, error)
}

type FilterResults

type FilterResults struct {
	Objects map[string]spdx.Object
	Error   error
}

func (*FilterResults) Apply

func (fr *FilterResults) Apply(filter Filter) *FilterResults

type MatcherFunction

type MatcherFunction func(spdx.Object) bool

type NameFilter

type NameFilter struct {
	Pattern string
	Regexp  *regexp.Regexp
}

func (*NameFilter) Apply

func (f *NameFilter) Apply(objects map[string]spdx.Object) (map[string]spdx.Object, error)

type ObjectCycler

type ObjectCycler struct{}

func (*ObjectCycler) Cycle

func (cycler *ObjectCycler) Cycle(objects map[string]spdx.Object, fn MatcherFunction) map[string]spdx.Object

func (*ObjectCycler) CycleFull

func (cycler *ObjectCycler) CycleFull(objects map[string]spdx.Object, fn MatcherFunction) map[string]spdx.Object

type PurlFilter

type PurlFilter struct {
	Pattern string
}

func (*PurlFilter) Apply

func (f *PurlFilter) Apply(objects map[string]spdx.Object) (map[string]spdx.Object, error)

Jump to

Keyboard shortcuts

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