mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-05 00:54:51 +08:00
Adding splat[] short hand to explode,collect,flatten,groupby,path,pivot,select and more
This commit is contained in:
@@ -14,6 +14,16 @@ var uniqueOperatorScenarios = []expressionScenario{
|
||||
"D0, P[], (!!seq)::[2, 1, 3]\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Unique splat",
|
||||
skipDoc: true,
|
||||
document: `[2,1,2]`,
|
||||
expression: `unique[]`,
|
||||
expected: []string{
|
||||
"D0, P[0], (!!int)::2\n",
|
||||
"D0, P[1], (!!int)::1\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Unique nulls",
|
||||
subdescription: "Unique works on the node value, so it considers different representations of nulls to be different",
|
||||
@@ -64,6 +74,16 @@ var uniqueOperatorScenarios = []expressionScenario{
|
||||
"D0, P[], (!!seq)::[{name: harry, pet: cat}, {pet: fish}]\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "unique by splat",
|
||||
skipDoc: true,
|
||||
document: `[{name: harry, pet: cat}, {pet: fish}, {name: harry, pet: dog}]`,
|
||||
expression: `unique_by(.name)[]`,
|
||||
expected: []string{
|
||||
"D0, P[0], (!!map)::{name: harry, pet: cat}\n",
|
||||
"D0, P[1], (!!map)::{pet: fish}\n",
|
||||
},
|
||||
},
|
||||
{
|
||||
skipDoc: true,
|
||||
document: `[{name: harry, pet: cat}, {pet: fish}, {name: harry, pet: dog}]`,
|
||||
|
||||
Reference in New Issue
Block a user