tplx

package
v5.14.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplateFuncMap = template.FuncMap{
	"escape":                    url.PathEscape,
	"unescaped":                 Unescaped,
	"urlconvert":                Urlconvert,
	"timeformat":                Timeformat,
	"timestamp":                 Timestamp,
	"args":                      Args,
	"reReplaceAll":              ReReplaceAll,
	"match":                     regexp.MatchString,
	"toUpper":                   strings.ToUpper,
	"toLower":                   strings.ToLower,
	"contains":                  strings.Contains,
	"humanize":                  Humanize,
	"humanize1024":              Humanize1024,
	"humanizeDuration":          HumanizeDuration,
	"humanizeDurationInterface": HumanizeDurationInterface,
	"humanizePercentage":        HumanizePercentage,
	"humanizePercentageH":       HumanizePercentageH,
	"add":                       Add,
	"sub":                       Subtract,
	"mul":                       Multiply,
	"div":                       Divide,
	"now":                       Now,
	"toString":                  ToString,
}

Functions

func Add added in v5.14.1

func Add(a, b interface{}) (interface{}, error)

Add returns the sum of a and b.

func Args added in v5.9.2

func Args(args ...interface{}) map[string]interface{}

func Divide added in v5.14.1

func Divide(a, b interface{}) (interface{}, error)

Divide returns the division of b from a.

func Humanize added in v5.9.2

func Humanize(s string) string

func Humanize1024 added in v5.9.2

func Humanize1024(s string) string

func HumanizeDuration added in v5.9.2

func HumanizeDuration(s string) string

func HumanizeDurationFloat64 added in v5.14.1

func HumanizeDurationFloat64(v float64) string

func HumanizeDurationInterface added in v5.14.1

func HumanizeDurationInterface(i interface{}) string

func HumanizePercentage added in v5.9.2

func HumanizePercentage(s string) string

func HumanizePercentageH added in v5.9.2

func HumanizePercentageH(s string) string

func Multiply added in v5.14.1

func Multiply(a, b interface{}) (interface{}, error)

Multiply returns the product of a and b.

func Now added in v5.14.1

func Now() time.Time

func ReReplaceAll added in v5.9.2

func ReReplaceAll(pattern, repl, text string) string

func Subtract added in v5.14.1

func Subtract(a, b interface{}) (interface{}, error)

Subtract returns the difference of b from a.

func Timeformat added in v5.9.2

func Timeformat(ts int64, pattern ...string) string

func Timestamp added in v5.9.2

func Timestamp(pattern ...string) string

func ToFloat64 added in v5.14.1

func ToFloat64(val interface{}) (float64, error)

ToFloat64 convert interface to float64

func ToString added in v5.14.1

func ToString(v interface{}) string

func Unescaped added in v5.9.2

func Unescaped(str string) interface{}

func Urlconvert added in v5.9.2

func Urlconvert(str string) interface{}

Types

This section is empty.

Jump to

Keyboard shortcuts

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