funcmap

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: GPL-3.0 Imports: 13 Imported by: 3

README

funcmap

Build Status

Go template functions.

import "github.com/gomatic/funcmap"

...

template.New(name).
    Funcs(funcmap.Map).
    Parse(templateSource).
    Execute(&result, templateVariables)

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Add added in v1.1.0

func Add(a, b int64) int64

`b` + `a`

func Basename added in v1.1.0

func Basename(path string, extensions ...string) string

func CIDRNext added in v1.1.0

func CIDRNext(cidr uint8, lowest, count, inc int8, addr []int64) []int64

TODO increment CIDR

func Cleanse added in v1.1.0

func Cleanse(r string) func(string) string

func Cleanser added in v1.1.0

func Cleanser(r, s string) string

func CommandLine added in v1.1.0

func CommandLine() string

Reproduce a command line string that reflects a usable command line.

func Debug added in v1.1.0

func Debug(any ...interface{}) string

func Debugger added in v1.1.0

func Debugger() (func() bool, func() bool)

toggle debugging

func DecToInt added in v1.1.0

func DecToInt(arr []string) []int64

func Div added in v1.1.0

func Div(a, b int64) int64

`b` / `a`

func Environment added in v1.1.0

func Environment(n string) string

func FromInt added in v1.1.0

func FromInt(format string, arr []int64) []string

func HexToInt added in v1.1.0

func HexToInt(arr []string) []int64

func IP4Add added in v1.1.0

func IP4Add(group uint8, lowest, count uint8, inc int8, addr []int64) []int64

Given a zero-based, left-to-right IP group index, lowest value, count, and increment, increment the group, cyclically.

func IP4Inc added in v1.1.0

func IP4Inc(group uint8, inc int8, addr string) string

func IP4Join added in v1.1.0

func IP4Join(addr []int64) string

func IP4Next added in v1.1.0

func IP4Next(group uint8, lowest, count uint8, addr string) string

func IP4Prev added in v1.1.0

func IP4Prev(group uint8, lowest, count uint8, addr string) string

func IP6Add added in v1.1.0

func IP6Add(group uint8, lowest, count uint16, inc int16, addr []int64) []int64

given a group, lowest, count, and increment, increment the group, circling around

func IP6Inc added in v1.1.0

func IP6Inc(group uint8, inc int16, addr string) string

func IP6Join added in v1.1.0

func IP6Join(addr []int64) string

func IP6Next added in v1.1.0

func IP6Next(group uint8, lowest, count uint16, addr string) string

func IP6Prev added in v1.1.0

func IP6Prev(group uint8, lowest, count uint16, addr string) string

func IPAdd added in v1.1.0

func IPAdd(bits int32, group uint8, lowest, count uint16, inc int16, addr []int64) []int64

Given a zero-based, left-to-right IP group index, lowest value, count, and increment, increment the group, cyclically.

func IPCalc added in v1.1.0

func IPCalc(bits int32, lowest, count, inc, value int64) int64

func IPInts added in v1.1.0

func IPInts(addr string) []int64

func IPMath added in v1.1.0

func IPMath(math, addr string) string

Performs IP math using a simple sequence of operations. e.g. _.[+2]._.[+1,%10]

func IPSplit added in v1.1.0

func IPSplit(addr string) []string

func Index added in v1.1.0

func Index(i int, a interface{}) interface{}

func IntParser added in v1.1.0

func IntParser(base int) func(s string) (int64, error)

func Join added in v1.1.0

func Join(sep string, arr []string) (s string)

func KeySequencer added in v1.1.0

func KeySequencer() func(string) int64

key-based sequencing.

func Mod added in v1.1.0

func Mod(a, b int64) int64

`b` modulo `a`

func Mul added in v1.1.0

func Mul(a, b int64) int64

`b` * `a`

func New added in v1.1.0

func New(options ...Optional) template.FuncMap

func Pause added in v1.1.0

func Pause(t int64) time.Time

func Rand added in v1.1.0

func Rand() int64

func ReInitcap added in v1.1.0

func ReInitcap(s string) string

func ReReplace added in v1.1.0

func ReReplace(n int, old, new, s string) string

func ReTrim added in v1.1.0

func ReTrim(cut, s string) string

func ReTrimLeft added in v1.1.0

func ReTrimLeft(cut, s string) string

func ReTrimRight added in v1.1.0

func ReTrimRight(cut, s string) string

func SafeDiv added in v1.1.0

func SafeDiv(a, b int64) int64

`b` divided by `a`. Returns `0` if `a == 0`.

func Sequencer added in v1.1.0

func Sequencer() func() int64

simple sequence generation.

func Split added in v1.1.0

func Split(sep, s string) []string

func Starter added in v1.1.0

func Starter() func() time.Time

To report a consistent time through a single template.

func Step added in v1.1.0

func Step(a int64, is ...int) int64

func Sub added in v1.1.0

func Sub(a, b int64) int64

`b` - `a`

func Substr added in v1.1.0

func Substr(start, end int, s string) string

func ToInt added in v1.1.0

func ToInt(base int, arr []string) []int64

Types

type Optional added in v1.1.0

type Optional func(*opt)

func WithClock added in v1.1.0

func WithClock(timeFunc clock.TimeFunction) Optional

func WithMap added in v1.1.0

func WithMap(fs template.FuncMap) Optional

func WithMaps added in v1.1.0

func WithMaps(fs ...template.FuncMap) Optional

func WithRightmostOverrides added in v1.1.0

func WithRightmostOverrides() Optional

func WithV1Map added in v1.1.0

func WithV1Map() Optional

func WithV2Map added in v1.1.0

func WithV2Map() Optional

func WithV3Map added in v1.1.0

func WithV3Map() Optional

Jump to

Keyboard shortcuts

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