validator

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadQuery         = errors.New("bad query")
	ErrComplicatedQuery = errors.New("complicated query")
	ErrAccessDenied     = errors.New("access denied")
	ErrUnknownTable     = errors.New("unknown table")
	ErrUnknownColumn    = errors.New("unknown column")
)

Functions

func FilterType

func FilterType[T tree.NodeFormatter](req tree.NodeFormatter) ([]T, error)

FilterType will filter objects with specified type.

func GetColumnNames

func GetColumnNames(req tree.NodeFormatter) ([]string, error)

GetColumnNames will return all mentioned columns from query. Note: It will have unexpected behavior for queries that have a subquery.

func IsAllowed

func IsAllowed(tables []config.TargetTable, acls []config.ACL, query string) error

func Walk

func Walk(collect func(formatter tree.NodeFormatter), statements ...tree.NodeFormatter) error

Types

type IVector

type IVector interface {
	Op() config.Op
	String() string
	Table() string
	Columns() []string
}

type VecSelect

type VecSelect struct {
	Tbl  string
	Cols []string
}

func MakeSelectVec

func MakeSelectVec(req *tree.Select) (*VecSelect, error)

func (VecSelect) Columns

func (v VecSelect) Columns() []string

func (VecSelect) Op

func (VecSelect) Op() config.Op

func (VecSelect) String

func (v VecSelect) String() string

func (VecSelect) Table

func (v VecSelect) Table() string

Jump to

Keyboard shortcuts

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