mirror of
https://github.com/mikefarah/yq.git
synced 2026-09-04 00:14:55 +08:00
Updating with documentation
This commit is contained in:
@@ -20,9 +20,10 @@ var withOperatorScenarios = []expressionScenario{
|
||||
},
|
||||
},
|
||||
{
|
||||
description: "Update array elements relatively",
|
||||
document: `myArray: [{a: apple},{a: banana}]`,
|
||||
expression: `with(.myArray[]; .b = .a + " yum")`,
|
||||
description: "Update array elements relatively",
|
||||
subdescription: "The second expression runs with each element of the array as it's contextual root. This allows you to make updates relative to the element.",
|
||||
document: `myArray: [{a: apple},{a: banana}]`,
|
||||
expression: `with(.myArray[]; .b = .a + " yum")`,
|
||||
expected: []string{
|
||||
"D0, P[], (doc)::myArray: [{a: apple, b: apple yum}, {a: banana, b: banana yum}]\n",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user