summaryrefslogtreecommitdiff
path: root/docs-src
diff options
context:
space:
mode:
Diffstat (limited to 'docs-src')
-rw-r--r--docs-src/content/functions/coll.yml44
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]