Skip to content

refactor: flatten nested query type to fields

Administrator requested to merge rvt/flatten-query-type into master

Created by: rvantonder

Before this change, we had two type definitions for Query, the one's members inlined inside the other. With the removal of the parse tree reference in #8559 , it is now easier to remove this inlining and use a type Fields instead. Instead of:

type Query struct {
	conf *types.Config // the typechecker config used to produce this query
	*types.Query // the underlying query
}

type Query struct {
	Fields map[string][]*Value // map of field name -> values
}

We now have:

type Query struct {
	conf *types.Config // the typechecker config used to produce this query
	types.Fields // the query fields
}

// map of field name -> values
type Fields map[string][]*Value

This is not the final end state. It is one crucial step to destructure the type definitions to simplify them and their references overall, so that the Query type can change to accommodate AND/OR expressions.

Merge request reports

Loading