summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorcmal <paul@cmal.info>2018-03-17 00:13:23 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2018-03-17 00:13:23 +0100
commite46ab29bd24caa9e2cfa51f24ba15037750850d6 (patch)
treef5fb38d843bdd7a9daadc5c8eb84de7d58ade6a5 /docs
parent10fef32de6e6cf20f8054e9833b1ad09fba6d5cb (diff)
hugolib: Add Reset method to delete key from Scratch
Diffstat (limited to 'docs')
-rw-r--r--docs/content/functions/scratch.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/content/functions/scratch.md b/docs/content/functions/scratch.md
index a827db543..b8fc0e59c 100644
--- a/docs/content/functions/scratch.md
+++ b/docs/content/functions/scratch.md
@@ -32,6 +32,7 @@ See [this Go issue](https://github.com/golang/go/issues/10608) for the main moti
* `Get` returns the `value` for the `key` given.
* `SetInMap` takes a `key`, `mapKey` and `value`
* `GetSortedMapValues` returns array of values from `key` sorted by `mapKey`
+* `Delete` takes a `key` to remove
`Set` and `SetInMap` can store values of any type.
@@ -69,6 +70,11 @@ The usage is best illustrated with some samples:
{{ $.Scratch.SetInMap "a3" "c" "CC" }}
{{ $.Scratch.SetInMap "a3" "b" "BB" }}
{{ $.Scratch.GetSortedMapValues "a3" }} {{/* => []interface {}{"AA", "BB", "CC"} */}}
+
+{{ $.Scratch.Add "a" 1 }}
+{{ $.Scratch.Delete "a" }}
+{{ $.Scratch.Add "a" 2 }}
+{{ $.Scratch.Get "a" }} {{/* => 2 */}}
```
{{% note %}}