package hstore
import "github.com/gohugoio/hugo/common/hstore"
Index ¶
- type Scratch
- func NewScratch() *Scratch
- func (c *Scratch) Add(key string, newAddend any) (string, error)
- func (c *Scratch) Delete(key string) string
- func (c *Scratch) DeleteInMap(key string, mapKey string) string
- func (c *Scratch) Get(key string) any
- func (c *Scratch) GetSortedMapValues(key string) any
- func (c *Scratch) Set(key string, value any) string
- func (c *Scratch) SetInMap(key string, mapKey string, value any) string
- func (c *Scratch) Values() map[string]any
- type StoreProvider
Types ¶
type Scratch ¶
type Scratch struct {
// contains filtered or unexported fields
}
Scratch is a writable context used for stateful build operations
func NewScratch ¶
func NewScratch() *Scratch
NewScratch returns a new instance of Scratch.
func (*Scratch) Add ¶
Add will, for single values, add (using the + operator) the addend to the existing addend (if found). Supports numeric values and strings.
If the first add for a key is an array or slice, then the next value(s) will be appended.
func (*Scratch) Delete ¶
Delete deletes the given key.
func (*Scratch) DeleteInMap ¶
DeleteInMap deletes a value to a map with the given key in the Node context.
func (*Scratch) Get ¶
Get returns a value previously set by Add or Set.
func (*Scratch) GetSortedMapValues ¶
GetSortedMapValues returns a sorted map previously filled with SetInMap.
func (*Scratch) Set ¶
Set stores a value with the given key in the Node context. This value can later be retrieved with Get.
func (*Scratch) SetInMap ¶
SetInMap stores a value to a map with the given key in the Node context. This map can later be retrieved with GetSortedMapValues.
func (*Scratch) Values ¶
Values returns the raw backing map. Note that you should just use this method on the locally scoped Scratch instances you obtain via newScratch, not .Page.Scratch etc., as that will lead to concurrency issues.
type StoreProvider ¶
type StoreProvider interface {
// Store returns a Scratch that can be used to store temporary state.
// Store is not reset on server rebuilds.
Store() *Scratch
}
Source Files ¶
- Version
- v0.153.4 (latest)
- Published
- Dec 28, 2025
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 4 months ago –
Tools for package owners.