query

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LookupFunc

type LookupFunc func(string) ([]string, error)

LookupFunc looks up a query string. It should return the corresponding URLs for the given string. It is not considered an error if the function returns an empty slice. The function should return an error if the query should fail.

type Parser

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

Parser represents a query parser.

func NewParser

func NewParser(query string) *Parser

NewParser create a new parser.

func (*Parser) Parse

func (p *Parser) Parse() (q *Query, err error)

Parse parses a query.

type Query

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

Query represents a query.

func New

func New(query string, lookup LookupFunc) (*Query, error)

New create a new query object from a query.

func (Query) Execute

func (q Query) Execute(idx index.Interface) ([]index.Entry, error)

Execute executes the query on the given index and returns the slice of the matched IndexEntries.

func (Query) ExecuteFunc

func (q Query) ExecuteFunc(idx index.Interface, f func(index.Entry) bool) error

ExecuteFunc executes the query on an index. The callback function is called for every matched IndexEntry.

func (Query) String

func (q Query) String() string

String returns a string representing the query.

Jump to

Keyboard shortcuts

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