query

package
v0.0.0-...-f8e8ada Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LowerRegexp

func LowerRegexp(r *syntax.Regexp) *syntax.Regexp

func VisitAtoms

func VisitAtoms(q Q, v func(q Q))

VisitAtoms runs `v` on all atom queries within `q`.

Types

type And

type And struct {
	Children []Q
}

And is matched when all its children are.

func (*And) String

func (q *And) String() string

type Branch

type Branch struct {
	Pattern string
}

Branch limits search to a specific branch.

func (*Branch) String

func (q *Branch) String() string

type Const

type Const struct {
	Value bool
}

func (*Const) String

func (q *Const) String() string

type Language

type Language struct {
	Language string
}

func (*Language) String

func (l *Language) String() string

type Not

type Not struct {
	Child Q
}

Not inverts the meaning of its child.

func (*Not) String

func (q *Not) String() string

type Or

type Or struct {
	Children []Q
}

Or is matched when any of its children is matched.

func (*Or) String

func (q *Or) String() string

type Q

type Q interface {
	String() string
}

Q is a representation for a possibly hierarchical search query.

func ExpandFileContent

func ExpandFileContent(q Q) Q

Expand expands Substr queries into (OR file_substr content_substr) queries, and the same for Regexp queries..

func Map

func Map(q Q, f func(q Q) Q) Q

Map runs f over the q.

func NewAnd

func NewAnd(qs ...Q) Q

NewAnd is syntactic sugar for constructing And queries.

func NewOr

func NewOr(qs ...Q) Q

NewOr is syntactic sugar for constructing Or queries.

func Parse

func Parse(qStr string) (Q, error)

Parse parses a string into a query.

func Simplify

func Simplify(q Q) Q

type Regexp

type Regexp struct {
	Regexp        *syntax.Regexp
	FileName      bool
	Content       bool
	CaseSensitive bool
}

RegexpQuery is a query looking for regular expressions matches.

func (*Regexp) String

func (q *Regexp) String() string

type Repo

type Repo struct {
	Pattern string
}

func (*Repo) String

func (q *Repo) String() string

type Substring

type Substring struct {
	Pattern       string
	CaseSensitive bool

	// Match only filename
	FileName bool

	// Match only content
	Content bool
}

Substring is the most basic query: a query for a substring.

func (*Substring) String

func (q *Substring) String() string

type SuggestQueryError

type SuggestQueryError struct {
	Message    string
	Suggestion string
}

func (*SuggestQueryError) Error

func (e *SuggestQueryError) Error() string

type Symbol

type Symbol struct {
	Atom *Substring
}

Symbol finds a string that is a symbol.

func (*Symbol) String

func (s *Symbol) String() string

Jump to

Keyboard shortcuts

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