template

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: Apache-2.0 Imports: 10 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNums

func AddNums[T float32 | int | int32 | float64 | int64 | uint64 | uint32 | uint](values ...T) (out T)

func DefaultFuncMap

func DefaultFuncMap() template.FuncMap

func ExpandAttrs

func ExpandAttrs(attrs map[string]any) template.JS

func FloatDiv

func FloatDiv[A Number, B Number](a A, b B) (out float64)

func IntDiv

func IntDiv[A Number, B Number](a A, b B) (out int64)

func MultNums

func MultNums[T float32 | int | int32 | float64 | int64 | uint64 | uint32 | uint](values ...T) (out T)

func NumList

func NumList[T float32 | int | int32 | float64 | int64 | uint64 | uint32 | uint](start, end, incr int) (out []T)

func SliceArray

func SliceArray(values any, offset, count any) any

func Slugify

func Slugify(input string) string

func SubNums

func SubNums[T float32 | int | int32 | float64 | int64 | uint64 | uint32 | uint](a, b T) (out T)

func TimeSinceString

func TimeSinceString(t time.Time) string

Given a time, returns a "x y ago" string where y is one of "years, months, weeks, days, hours, minutes, seconds"

func ToFloat

func ToFloat(v any) float64

func ToInt

func ToInt(v any) int

func ToString

func ToString(v any) string

func ValuesToDict

func ValuesToDict(values ...any) (map[string]any, error)

Types

type Number

type Number interface {
	float32 | int | int32 | float64 | int64 | uint64 | uint32 | uint
}

Jump to

Keyboard shortcuts

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