summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorjeevansai <jeevansai502@gmail.com>2022-02-05 19:52:00 +0530
committerGitHub <noreply@github.com>2022-02-05 09:22:00 -0500
commit0ca223237a0714eebe4e8f3da10e09031999537f (patch)
tree0d0d45c2905558545e866939b72b41b12992dcca /docs
parentd3a425a554342986cf20dd70e6327e0598dcfd91 (diff)
Add function to list datasources (#1287)
* Add function to list datasources * Sort datasources in ascending order and return in listDatasources * Fix lint error Signed-off-by: Dave Henderson <dhenderson@gmail.com> Co-authored-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/content/functions/data.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/docs/content/functions/data.md b/docs/content/functions/data.md
index 4845de60..31d2b27c 100644
--- a/docs/content/functions/data.md
+++ b/docs/content/functions/data.md
@@ -97,6 +97,24 @@ $ gomplate -i '{{if (datasourceReachable "test")}}{{datasource "test"}}{{else}}n
no worries
```
+## `listDatasources`
+
+Lists all the datasources defined, list returned will be sorted in ascending order.
+
+### Usage
+
+```go
+listDatasources
+```
+
+### Examples
+
+```console
+$ gomplate -d person=env:///FOO -d bar=env:///BAR -i '{{range (listDatasources)}} Datasource-{{.}} {{end}}'
+Datasource-bar
+Datasource-person
+```
+
## `defineDatasource`
Define a datasource alias with target URL inside the template. Overridden by the [`--datasource/-d`](../../usage/#datasource-d) flag.