filter

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AndExpr

type AndExpr struct {
	Left  FilterExpr
	Right FilterExpr
}

type FilterExpr

type FilterExpr interface {
	// contains filtered or unexported methods
}

type IdMappingFunc

type IdMappingFunc func(typ string, name string) string

type InTableExpr

type InTableExpr struct {
	Not   bool
	Table Table
	Ids   []string
}

type Name

type Name struct {
	Kind NameKind
	Name string
}

type NameKind

type NameKind int
const (
	NameKindString NameKind = iota
	NameKindNumber
)

type OpExpr

type OpExpr struct {
	Kind  OpKind
	Name  string
	Value any
}

type OpKind

type OpKind int
const (
	OpEqual OpKind = iota
	OpNotEqual
	OpLike
	OpGreater
)

type OrExpr

type OrExpr struct {
	Left  FilterExpr
	Right FilterExpr
}

type Resolver

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

func New

func New(adpater ResolverAdapter) *Resolver

func (*Resolver) InTable

func (r *Resolver) InTable(name, typ string, args []ast.Expr) (*InTableExpr, error)

func (*Resolver) Resolve

func (r *Resolver) Resolve(e ast.Expr) (FilterExpr, error)

func (*Resolver) ResolveToIdent

func (r *Resolver) ResolveToIdent(e ast.Expr) string

func (*Resolver) ResolveToNumber

func (r *Resolver) ResolveToNumber(e ast.Expr) int64

func (*Resolver) ResolveToStr

func (r *Resolver) ResolveToStr(e ast.Expr) string

type ResolverAdapter

type ResolverAdapter interface {
	GetDefaultSort() string

	MapNameToId(typ, name string) (string, error)
	// TODO(patrik): Rename to ResolveVariableName
	MapName(name string) (Name, error)

	ResolveTable(typ string) (Table, error)

	ResolveFunctionCall(resolver *Resolver, name string, args []ast.Expr) (FilterExpr, error)
}

type Table

type Table struct {
	Name       string
	SelectName string
	WhereName  string
}

Jump to

Keyboard shortcuts

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