builder

package
v0.1.30 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder provides methods for creating command filters

func New

func New(opts ...Option) *Builder

New creates a new Builder with the given options

func (*Builder) AllTags

func (b *Builder) AllTags(tags ...string) *FilterBuilder

AllTags creates a filter that matches commands having all the given tags

func (*Builder) AnyTags

func (b *Builder) AnyTags(tags ...string) *FilterBuilder

AnyTags is an alias for Tags

func (*Builder) MatchAll

func (b *Builder) MatchAll() *FilterBuilder

MatchAll creates a filter that matches all commands

func (*Builder) Metadata

func (b *Builder) Metadata(key string, value interface{}) *FilterBuilder

Metadata creates a filter that matches commands by metadata field value

func (*Builder) MetadataMatch

func (b *Builder) MetadataMatch(matches map[string]interface{}) *FilterBuilder

MetadataMatch creates a filter that matches commands by multiple metadata fields

func (*Builder) Name

func (b *Builder) Name(name string) *FilterBuilder

Name creates a filter that matches commands by exact name

func (*Builder) NamePattern

func (b *Builder) NamePattern(pattern string) *FilterBuilder

NamePattern creates a filter that matches commands by name pattern

func (*Builder) Path

func (b *Builder) Path(path string) *FilterBuilder

Path creates a filter that matches commands by exact path

func (*Builder) PathGlob

func (b *Builder) PathGlob(pattern string) *FilterBuilder

PathGlob creates a filter that matches commands by path glob pattern

func (*Builder) PathPrefix

func (b *Builder) PathPrefix(prefix string) *FilterBuilder

PathPrefix creates a filter that matches commands by path prefix

func (*Builder) Tag

func (b *Builder) Tag(tag string) *FilterBuilder

Tag creates a filter that matches commands having a specific tag

func (*Builder) Tags

func (b *Builder) Tags(tags ...string) *FilterBuilder

Tags creates a filter that matches commands having any of the given tags

func (*Builder) Type

func (b *Builder) Type(type_ string) *FilterBuilder

Type creates a filter that matches commands by type

func (*Builder) Types

func (b *Builder) Types(types ...string) *FilterBuilder

Types creates a filter that matches commands by any of the given types

type FilterBuilder

type FilterBuilder struct {
	// contains filtered or unexported fields
}

FilterBuilder provides methods for building and combining filters

func Must

func Must(filter *FilterBuilder, err error) *FilterBuilder

Must is a helper that panics if err is not nil

func NewFilter

func NewFilter(q query.Query) *FilterBuilder

NewFilter creates a new FilterBuilder from a raw query

func NewFilterBuilder

func NewFilterBuilder(q query.Query, opts *Options) *FilterBuilder

NewFilterBuilder creates a new FilterBuilder with the given query and options

func (*FilterBuilder) And

func (f *FilterBuilder) And(others ...*FilterBuilder) *FilterBuilder

And combines this filter with others using AND logic

func (*FilterBuilder) Build

func (f *FilterBuilder) Build() query.Query

Build returns the underlying Bleve query

func (*FilterBuilder) Not

func (f *FilterBuilder) Not() *FilterBuilder

Not negates this filter

func (*FilterBuilder) Or

func (f *FilterBuilder) Or(others ...*FilterBuilder) *FilterBuilder

Or combines this filter with others using OR logic

type Option

type Option func(*Options)

Option is a function that configures the builder options

func WithDefaultConjunctionMinimum

func WithDefaultConjunctionMinimum(min_ float64) Option

WithDefaultConjunctionMinimum sets the minimum number of clauses that must match for conjunction queries

func WithDefaultDisjunctionMinimum

func WithDefaultDisjunctionMinimum(min_ float64) Option

WithDefaultDisjunctionMinimum sets the minimum number of clauses that must match for disjunction queries

func WithDefaultFieldBoost

func WithDefaultFieldBoost(boost float64) Option

WithDefaultFieldBoost sets the default boost value for field queries

type Options

type Options struct {
	// DefaultFieldBoost is the default boost value for field queries
	DefaultFieldBoost float64
	// DefaultConjunctionMinimum is the minimum number of clauses that must match for conjunction queries
	DefaultConjunctionMinimum float64
	// DefaultDisjunctionMinimum is the minimum number of clauses that must match for disjunction queries
	DefaultDisjunctionMinimum float64
}

Options contains configuration for the query builder

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions returns the default options

Jump to

Keyboard shortcuts

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