parser

package
v0.0.0-...-f77d796 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// NoTopicID is a topic ID that won't match anything
	NoTopicID = "00000000-0000-0000-0000-000000000000"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type QuerySpec

type QuerySpec struct {
	Input        *string
	Tokens       []string
	StringTokens []string
	Topics       []TopicSpec
}

QuerySpec encapsulates a search query.

func Parse

func Parse(input *string) *QuerySpec

Parse parses the input string and returns a query spec that can be used for constructing complex SQL queries

func (QuerySpec) EscapedPostgresTsQueryInput

func (s QuerySpec) EscapedPostgresTsQueryInput() interface{}

EscapedPostgresTsQueryInput returns a set of wildcard tokens that can be used in a Postgres full text search.

func (QuerySpec) ExplicitTopicIds

func (s QuerySpec) ExplicitTopicIds() []interface{}

ExplicitTopicIds returns the topic ids explicitly specified in the query

func (QuerySpec) TokenInput

func (s QuerySpec) TokenInput() string

TokenInput returns the search string stripped of special search types

func (QuerySpec) WildcardStringArray

func (s QuerySpec) WildcardStringArray() interface{}

WildcardStringArray returns an array of wildcard tokens that can be used in a SQL query. The assumption here is that the individual tokens will be passed through appropriate sanitization. The tokens in the array that is returned are not safe to interpolate directly into a SQL query.

type TopicSpec

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

TopicSpec provides information about a topic that has been included in a query

func (TopicSpec) ID

func (s TopicSpec) ID() string

ID returns the uuid for the topic, assuming the resource path is well-formed. If it is not, return a zeroed-out uuid

Jump to

Keyboard shortcuts

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