diff options
| author | Dave Henderson <dhenderson@gmail.com> | 2020-05-04 22:11:23 -0400 |
|---|---|---|
| committer | Dave Henderson <dhenderson@gmail.com> | 2020-05-04 22:20:58 -0400 |
| commit | 3ca4f8944e4f4ea43c53f1fed074e4199f04074d (patch) | |
| tree | 5b091e0579a7fc3773d39d065c53dd3e16822610 /docs-src | |
| parent | 8f6ec3d319569029b7f81d4c1eca4c359328d177 (diff) | |
New functions coll.Pick and coll.Omit
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs-src')
| -rw-r--r-- | docs-src/content/functions/coll.yml | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/docs-src/content/functions/coll.yml b/docs-src/content/functions/coll.yml index 8a9917f1..cf267fe1 100644 --- a/docs-src/content/functions/coll.yml +++ b/docs-src/content/functions/coll.yml @@ -301,3 +301,47 @@ funcs: {{ $src2 := dict "foo" 3 "bar" 5 }} {{ coll.Merge $dst $src1 $src2 }}' map[foo:1 bar:5 baz:4] + - name: coll.Pick + description: | + Given a map, returns a new map with any entries that have the given keys. + + All keys are converted to strings. + + This is the inverse of [`coll.Omit`](#coll-omit). + + _Note that this function does not modify the input._ + pipeline: true + arguments: + - name: keys... + required: true + description: the keys to match + - name: map + required: true + description: the map to pick from + examples: + - | + $ gomplate -i '{{ $data := dict "foo" 1 "bar" 2 "baz" 3 }} + {{ coll.Pick "foo" "baz" $data }}' + map[baz:3 foo:1] + - name: coll.Omit + description: | + Given a map, returns a new map without any entries that have the given keys. + + All keys are converted to strings. + + This is the inverse of [`coll.Pic`](#coll-pick). + + _Note that this function does not modify the input._ + pipeline: true + arguments: + - name: keys... + required: true + description: the keys to match + - name: map + required: true + description: the map to omit from + examples: + - | + $ gomplate -i '{{ $data := dict "foo" 1 "bar" 2 "baz" 3 }} + {{ coll.Omit "foo" "baz" $data }}' + map[bar:2] |
