tplx

package
v6.0.0-ga.1 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 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

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

Add returns the sum of a and b.

func Args

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

func Divide

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

Divide returns the division of b from a.

func Humanize

func Humanize(s string) string

func Humanize1024

func Humanize1024(s string) string

func HumanizeDuration

func HumanizeDuration(s string) string

func HumanizeDurationFloat64

func HumanizeDurationFloat64(v float64) string

func HumanizeDurationInterface

func HumanizeDurationInterface(i interface{}) string

func HumanizePercentage

func HumanizePercentage(s string) string

func HumanizePercentageH

func HumanizePercentageH(s string) string

func Multiply

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

Multiply returns the product of a and b.

func Now

func Now() time.Time

func ReReplaceAll

func ReReplaceAll(pattern, repl, text string) string

func Subtract

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

Subtract returns the difference of b from a.

func Timeformat

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

func Timestamp

func Timestamp(pattern ...string) string

func ToFloat64

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

ToFloat64 convert interface to float64

func ToString

func ToString(v interface{}) string

func Unescaped

func Unescaped(str string) interface{}

func Urlconvert

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