Adding splat[] short hand to explode,collect,flatten,groupby,path,pivot,select and more

This commit is contained in:
Mike Farah
2024-06-16 10:48:01 +10:00
parent f1964dece0
commit d58870b056
14 changed files with 146 additions and 13 deletions
+10
View File
@@ -13,6 +13,16 @@ var groupByOperatorScenarios = []expressionScenario{
"D0, P[], (!!seq)::- - {foo: 1, bar: 10}\n - {foo: 1, bar: 1}\n- - {foo: 3, bar: 100}\n",
},
},
{
description: "Group splat",
skipDoc: true,
document: `[{foo: 1, bar: 10}, {foo: 3, bar: 100}, {foo: 1, bar: 1}]`,
expression: `group_by(.foo)[]`,
expected: []string{
"D0, P[0], (!!seq)::- {foo: 1, bar: 10}\n- {foo: 1, bar: 1}\n",
"D0, P[1], (!!seq)::- {foo: 3, bar: 100}\n",
},
},
{
description: "Group by field, with nulls",
document: `[{cat: dog}, {foo: 1, bar: 10}, {foo: 3, bar: 100}, {no: foo for you}, {foo: 1, bar: 1}]`,