search

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	MaxQueryLen       = 255
	MaxResults        = 150
	DefaultMaxResults = 15
)

Shared configuration for search methods.

Variables

This section is empty.

Functions

func Cursor

func Cursor(state interface{}) (string, error)

Cursor will return a cursor for the given state data.

func Escape

func Escape(s string) string

Escape will escape a search string for use with the Postgres `like` and `ilike` operators.

func ParseCursor

func ParseCursor(c string, state interface{}) error

ParseCursor will parse the data held in cursor c into the passed state object.

func RenderQuery

func RenderQuery(ctx context.Context, tmpl *template.Template, data RenderData) (query string, args []interface{}, err error)

RenderQuery will render a search query with the given template and data. Named args in the format `:name:` will be replaced with the appropriate numbered args (e.g. `$1`, `$2`)

Types

type RenderData

type RenderData interface {
	QueryArgs() []sql.NamedArg
}

RenderData is used as the data for a template with the ability to output a list of all possible arguments.

Jump to

Keyboard shortcuts

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