Documentation ¶
Index ¶
- Variables
- func ApplyAggregators(log restql.Logger, query domain.Query, resources domain.Resources) domain.Resources
- func ApplyFilters(log restql.Logger, query domain.Query, resources domain.Resources) (domain.Resources, error)
- func ApplyHidden(query domain.Query, resources domain.Resources) domain.Resources
- func ResolveVariables(query domain.Query, input restql.QueryInput) domain.Query
- type Evaluator
- type MappingsReader
- type QueryReader
Constants ¶
This section is empty.
Variables ¶
var ErrMapping = errors.New("unknown mappings")
ErrMapping is returned by Evaluator when the asked query references a non existing mapping.
var ErrParser = errors.New("parsing error")
ErrParser is returned by Evaluator when the asked query has invalid syntax.
var ErrTimeout = errors.New("timeout")
ErrTimeout is returned by Evaluator when the query execution time exceeds the maximum time defined in configuration.
var ErrValidation = errors.New("validation error")
ErrValidation is returned by Evaluator when the query execution request contains invalid information. • Namespace: is an empty string or is not present • QueryRevisions name: is an empty string or is not present • Revision: is not a positive integer • Tenant: is an empty string or is not present
Functions ¶
func ApplyAggregators ¶
func ApplyAggregators(log restql.Logger, query domain.Query, resources domain.Resources) domain.Resources
ApplyAggregators resolves the `in` keyword in the query, taking values from one statement result than setting it on target statement result.
func ApplyFilters ¶
func ApplyFilters(log restql.Logger, query domain.Query, resources domain.Resources) (domain.Resources, error)
ApplyFilters returns a version of the already resolved Resources only with the fields defined by the `only` clause.
func ApplyHidden ¶
ApplyHidden returns a version of the already resolved Resources removing the statement results with the `hidden` clause.
func ResolveVariables ¶
ResolveVariables returns a restQL query with all variables resolved to values present in the client body, query parameters or headers, in this specific order.
Types ¶
type Evaluator ¶
type Evaluator struct {
// contains filtered or unexported fields
}
Evaluator is the interpreter of the restQL language. It can execute saved or ad-hoc queries.
func NewEvaluator ¶
func NewEvaluator(log restql.Logger, mr MappingsReader, qr QueryReader, r runner.Runner, p parser.Parser, l plugins.Lifecycle) Evaluator
NewEvaluator constructs an instance of the restQL interpreter.
func (Evaluator) AdHocQuery ¶
func (e Evaluator) AdHocQuery(ctx context.Context, queryTxt string, queryOpts restql.QueryOptions, queryInput restql.QueryInput) (domain.Resources, error)
AdHocQuery executes an ad-hoc send by the client with the options and HTTP information.
func (Evaluator) SavedQuery ¶
func (e Evaluator) SavedQuery(ctx context.Context, queryOpts restql.QueryOptions, queryInput restql.QueryInput) (domain.Resources, error)
SavedQuery executes a saved query identified by namespace, id and revision with the options and HTTP information send by the client.
type MappingsReader ¶
type MappingsReader interface {
FromTenant(ctx context.Context, tenant string) (map[string]restql.Mapping, error)
}
MappingsReader is an interface implemented by types that can fetch a collection of mapping for the given tenant.
type QueryReader ¶
type QueryReader interface {
Get(ctx context.Context, namespace, id string, revision int) (restql.SavedQueryRevision, error)
}
QueryReader is an interface implemented by types that can fetch a query for the given identification (namespace, id, revision).