search

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

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