query

package
v1.12.4 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package query is inspired and partially copied from by github.com/cch123/elasticsql.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConverterError

func NewConverterError(text string) error

Types

type Converter

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

func NewConverter

func NewConverter(fnInterceptor FieldNameInterceptor, fvInterceptor FieldValuesInterceptor) *Converter

func (*Converter) ConvertWhereOrderBy

func (c *Converter) ConvertWhereOrderBy(whereOrderBy string) (*elastic.BoolQuery, []*elastic.FieldSort, error)

ConvertWhereOrderBy transforms WHERE SQL statement to Elasticsearch query. It also supports ORDER BY clause.

type ConverterError

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

func (*ConverterError) Error

func (c *ConverterError) Error() string

type FieldNameInterceptor

type FieldNameInterceptor interface {
	Name(name string, usage FieldNameUsage) (string, error)
}

type FieldNameUsage

type FieldNameUsage int
const (
	FieldNameFilter FieldNameUsage = iota
	FieldNameSorter
)

type FieldValuesInterceptor

type FieldValuesInterceptor interface {
	Values(name string, values ...interface{}) ([]interface{}, error)
}

Jump to

Keyboard shortcuts

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