dict

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Namespace

type Namespace struct {
	// contains filtered or unexported fields
}

Namespace defines the methods for dicts to be used as template functions.

func New

func New(d *deps.Deps) *Namespace

Creates a new dict Namespace

func (*Namespace) Dict

func (ns *Namespace) Dict(values ...interface{}) (map[string]interface{}, error)

Dict

Allows to pass multiple values to templates to use inside a template call for use with the post loop or partial calls.

Returns errors.TEMPLATE if the dict values are not divisible by two or any dict keys were not strings.

Example: {{ dict "colour" "green" "height" 20 }} Returns: map[string]interface{}{"colour":"green", "height":20}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL