validator

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2025 License: GPL-3.0 Imports: 6 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 IsAllowed

func IsAllowed(schema *DbSchema, haveAccess func(Vec) bool, query string) error

IsAllowed will tokenize query, validate schema and check access after all.

func ValidateAccess added in v0.12.0

func ValidateAccess(vectors []Vec, haveAccess func(Vec) bool) error

ValidateAccess check that all vectors is allowed to run.

func ValidateSchema added in v0.12.0

func ValidateSchema(vectors []Vec, schema *DbSchema) error

ValidateSchema will check that request contains only allowed(known) columns.

Types

type DbSchema added in v0.14.0

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

func NewDbSchema added in v0.14.0

func NewDbSchema(defaultSchema string, tables []config.TargetTable) *DbSchema

func (*DbSchema) GetTable added in v0.14.0

func (s *DbSchema) GetTable(tblName string) (config.TargetTable, bool)

GetTable returns table when tblName is registered in DbSchema.tables event with/without schema.

type Vec added in v0.5.0

type Vec struct {
	Op   config.Op
	Tbl  string
	Cols []string
}

func MakeVectors added in v0.12.0

func MakeVectors(query string) ([]Vec, error)

MakeVectors create vectors from query.

func (Vec) String added in v0.5.0

func (v Vec) String() string

Jump to

Keyboard shortcuts

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