use

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package use provides simple namespaces for custom functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FuncMap

type FuncMap template.FuncMap

FuncMap is a template.FuncMap, see docs there. Redefined to minimize imports.

func Packages

func Packages(pkgs ...Pkg) FuncMap

Packages collects functions from all "packages" in arguments into one FuncMap, converting every function name in "package" with Pkg.MapName and prefixing it with Pkg.Prefix.

type Pkg

type Pkg struct {
	// Prefix added to function name (can be empty).
	Prefix string
	// Function to translate function name (can be nil).
	MapName func(string) string
	// Map of functions.
	Funcs FuncMap
}

Pkg described single "package" of related functions. "Package" can be included into the map with every function, prefixed with Prefix. This is namespaces mechanism for poor. MapNames is a function invoking for each key within Funcs to convert names using custom rules. This can be used to adapt names to use with different interpreters.

Jump to

Keyboard shortcuts

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