Add query
/reference
as a first-class VRL type.
#25
Labels
type: feature
A value-adding code addition that introduce new functionality.
vrl: compiler
Changes to the compiler
A note for the community
Use Cases
Today the syntax for "reading a value from an object", and "a query path referencing a field of an object" are identical.
Examples
query an object
delete a field
Having a distinct syntax for creating references vs accessing a field could allow more elegant code and reduce confusion here.
As an example, a vector user attempted to delete multiple fields in an object by using the following code (which doesn't work):
fields
here just contains an array of strings, which fails to compile sincedel
expects "queries". Iffields
was switched tofields = [.source_type, .kubernetes.pod_ip]
, then it would just contain an array of the values that the query paths point to.I am proposing that additional syntax is added to create "references", which just point to specific fields/indices of objects/arrays.
This is just a standard query path with
&
appended. For example,a = &.foo.bar
would mean that the local variablea
is a reference to.foo.bar
. The above invalid example could be re-written with these changes so it would work as expected.Note that this would require some additional work before it could be it could be implemented:
Value
types not in Vector #26Version
0.24.0
The text was updated successfully, but these errors were encountered: