Template Functions

Note that template functions are not available for external template engines.

var FuncMap = map[string]interface{}
camelhttps://godoc.org/github.com/codemodus/kace#Camel
comparehttps://golang.org/pkg/strings/#Compare
containshttps://golang.org/pkg/strings/#Contains
containsAnyhttps://golang.org/pkg/strings/#ContainsAny
counthttps://golang.org/pkg/strings/#Count
decdec (see below)
equalFoldhttps://golang.org/pkg/strings/#EqualFold
fieldshttps://golang.org/pkg/strings/#Fields
hasPrefixhttps://golang.org/pkg/strings/#HasPrefix
hasSuffixhttps://golang.org/pkg/strings/#HasSuffix
incinc (see below)
strIndexhttps://golang.org/pkg/strings/#Index
indexAnyhttps://golang.org/pkg/strings/#IndexAny
joinhttps://golang.org/pkg/strings/#Join
kebabhttps://godoc.org/github.com/codemodus/kace#Kebab
kebabUpperhttps://godoc.org/github.com/codemodus/kace#KebabUpper
lastIndexhttps://golang.org/pkg/strings/#LastIndex
lastIndexAnyhttps://golang.org/pkg/strings/#LastIndexAny
makeMapmakeMap (see below)
makeSlicemakeSlice (see below)
numbersnumbers (see below)
pascalhttps://godoc.org/github.com/codemodus/kace#Pascal
pluralhttps://godoc.org/github.com/jinzhu/inflection#Plural
repeathttps://golang.org/pkg/strings/#Repeat
replacehttps://golang.org/pkg/strings/#Replace
singularhttps://godoc.org/github.com/jinzhu/inflection#Singular
sliceStringsliceString (see below)
snakehttps://godoc.org/github.com/codemodus/kace#Snake
snakeUpperhttps://godoc.org/github.com/codemodus/kace#SnakeUpper
splithttps://golang.org/pkg/strings/#Split
splitAfterhttps://golang.org/pkg/strings/#SplitAfter
splitAfterNhttps://golang.org/pkg/strings/#SplitAfterN
splitNhttps://golang.org/pkg/strings/#SplitN
subsub (see below)
sumsum (see below)
titlehttps://golang.org/pkg/strings/#Title
toLowerhttps://golang.org/pkg/strings/#ToLower
toTitlehttps://golang.org/pkg/strings/#ToTitle
toUpperhttps://golang.org/pkg/strings/#ToUpper
trimhttps://golang.org/pkg/strings/#Trim
trimLefthttps://golang.org/pkg/strings/#TrimLeft
trimPrefixhttps://golang.org/pkg/strings/#TrimPrefix
trimRighthttps://golang.org/pkg/strings/#TrimRight
trimSpacehttps://golang.org/pkg/strings/#TrimSpace
trimSuffixhttps://golang.org/pkg/strings/#TrimSuffix

dec

package environ // import "gnorm.org/gnorm/environ"

func dec(x int) int dec decrements the argument’s value by 1.

inc

package environ // import "gnorm.org/gnorm/environ"

func inc(x int) int inc increments the argument’s value by 1.

makeMap

package environ // import "gnorm.org/gnorm/environ"

func makeMap(vals …interface{}) (map[string]interface{}, error) makeMap expects an even number of parameters, in order to have name:value pairs. All even values must be strings as keys. Odd values may be any value. This is used to make maps to pass information into sub templates, range statements, etc.

makeSlice

package environ // import "gnorm.org/gnorm/environ"

func makeSlice(vals …interface{}) interface{} makeSlice returns the arguments as a single slice. If all the arguments are strings, they are returned as a []string, otherwise they’re returned as []interface{}.

numbers

package environ // import "gnorm.org/gnorm/environ"

func numbers(start, end int) data.Strings numbers returns a slice of strings of the numbers start to end (inclusive).

sliceString

package environ // import "gnorm.org/gnorm/environ"

func sliceString(s string, start, end int) string sliceString returns a slice of s from index start to end.

sub

package environ // import "gnorm.org/gnorm/environ"

func sub(x int, vals …int) int sub subtracts the second and following values from the first argument.

sum

package environ // import "gnorm.org/gnorm/environ"

func sum(vals …int) int sum returns the sum of its arguments.