sprig library (Go docs).
Tip
|
If you are reading this README on the Go Module Directory documentation (https://pkg.go.dev/r00t2.io/goutils/tplx/sprigx) or the directory landing page (https://git.r00t2.io/r00t2/go_goutils/src/branch/master/tplx/sprigx), it may not render correctly. Anchor-links (links within this document to other sections of this document) will likely also not work. Be sure to view it at properly via the in-repo AsciiDoc rendering or by downloading and viewing the HTML version in a browser locally and/or rendering a PDF version. |
github:gabyx/Githooks) but can be re-rendered on-demand locally via:
asciidoctor-pdf. It is not included in git automatically because binary files that change on each commit is not a good idea for git, especially for a repo that gets cloned as part of a library inclusion in a module/package dependency system (like `gomod`).
CombinedFuncMap
github.com/Masterminds/sprig/v3.GenericFuncMap.
CombinedHtmlFuncMap
github.com/Masterminds/sprig/v3.HtmlFuncMap.
CombinedTxtFuncMap
github.com/Masterminds/sprig/v3.TxtFuncMap.
FuncMap
HtmlFuncMap
html/template.FuncMap.
Nop
TxtFuncMap
text/template.FuncMap.
dump
github.com/davecgh/go-spew/spew.Sdump for whatever object(s) is/are passed to it.
metaIsNil
text/template.IsTrue and html/template.IsTrue (expressed in templates as `{{ if … }}`) leaves, as those functions/expressions return false for e.g. `false` booleans AND nils.
net
net.
netCidrMask
net.CIDRMask.
netExtractAddr
net.ParseCIDR and returns the net.IP component.
netExtractHost
net.SplitHostPort and returns the host component (as a string).
netExtractIpnet
net.ParseCIDR and returns the net.IPNet component.
netExtractPort
net.SplitHostPort and returns the port component (as a uint16).
netIfaces
net.Interfaces.
netIp4Mask
net.IPv4Mask.
netJoinHostPort
net.JoinHostPort.
netParseIP
net.ParseIP.
net/netip
net/netip.
netipAddrPort
net/netip.AddrPortFrom.
netipParseAddr
net/netip.ParseAddr.
netipParseAddrPort
net/netip.ParseAddrPort.
netipParsePrefix
net/netip.ParsePrefix.
netipPrefix
net/netip.PrefixFrom.
go4.org/netipx
go4.org/netipx.
netipxAddrIpNet
go4.org/netipx.AddrIPNet.
netipxCmpPfx
go4.org/netipx.ComparePrefix.
netipxFromStdAddr
go4.org/netipx.FromStdAddr. Instead of returning a boolean as the second value, it will instead be an error if the wrapped boolean is false.
netipxFromIp
go4.org/netipx.FromStdIP. Instead of returning a boolean as the second value, it will instead be an error if the wrapped boolean is false.
netipxFromIpNet
go4.org/netipx.FromStdIPNet. Instead of returning a boolean as the second value, it will instead be an error if the wrapped boolean is false.
netipxParseRange
go4.org/netipx.ParseIPRange.
netipxPfxAddr
go4.org/netipx.ParsePrefixOrAddr.
netipxPfxIpNet
go4.org/netipx.PrefixIPNet.
netipxPfxLast
go4.org/netipx.PrefixLastIP.
netipxPfxRange
go4.org/netipx.RangeOfPrefix.
netipxRange
go4.org/netipx.IPRangeFrom.
r00t2.io/goutils/netx
r00t2.io/goutils/netx.
netxAddrRfc
r00t2.io/goutils/netx.AddrRfc.
netxAddrRfc
r00t2.io/goutils/netx.Cidr4ToIPMask.
netxCidr4Mask
r00t2.io/goutils/netx.Cidr4ToMask.
netxCidr4Str
r00t2.io/goutils/netx.Cidr4ToStr.
netxFamilyVer
r00t2.io/goutils/netx.FamilyToVer.
netxGetAddrFam
r00t2.io/goutils/netx.GetAddrFamily.
netxGetIpFam
r00t2.io/goutils/netx.GetIpFamily.
netxIpRfc
r00t2.io/goutils/netx.IpRfc.
netxIpRfcStr
r00t2.io/goutils/netx.IpRfcStr.
netxIpStripRfc
r00t2.io/goutils/netx.IpStripRfcStr.
netxIp4MaskCidr
r00t2.io/goutils/netx.IPMask4ToCidr.
netxIp4MaskMask
r00t2.io/goutils/netx.IPMask4ToMask.
netxIp4MaskStr
r00t2.io/goutils/netx.IPMask4ToStr.
netxIpVerStr
r00t2.io/goutils/netx.IpVerStr.
netxIsBrktd6
r00t2.io/goutils/netx.IsBracketedIp6.
netxIsIp
r00t2.io/goutils/netx.IsIpAddr.
netxIsPfx
r00t2.io/goutils/netx.IsPrefixNet.
netxMask4Cidr
r00t2.io/goutils/netx.Mask4ToCidr.
netxMask4StrCidr
r00t2.io/goutils/netx.Mask4StrToCidr.
netxMask4StrIpMask
r00t2.io/goutils/netx.Mask4StrToIPMask.
netxMask4StrMask
r00t2.io/goutils/netx.Mask4StrToMask.
netxVerFamily
r00t2.io/goutils/netx.VerToFamily.
r00t2.io/goutils/netx/dnsx
r00t2.io/goutils/tplx/sprigx/netx/dnsx.
dnsxPtrAddr
r00t2.io/goutils/tplx/sprigx/netx/dnsx.AddrFromPtr.
dnsxAddrPtr
r00t2.io/goutils/tplx/sprigx/netx/dnsx.AddrToPtr.
dnsxStrWire
r00t2.io/goutils/tplx/sprigx/netx/dnsx.DnsStrToWire.
dnsxWireStr
r00t2.io/goutils/tplx/sprigx/netx/dnsx.DnsWireToStr.
dnsxPtrIp
r00t2.io/goutils/tplx/sprigx/netx/dnsx.IpFromPtr.
dnsxIpPtr
r00t2.io/goutils/tplx/sprigx/netx/dnsx.IpToPtr.
dnsxIsFqdn
r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsFqdn.
dnsxIsTxt
r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsFqdnDefinedTxt.
dnsxIsNsec3
r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsFqdnNsec3.
dnsxIsSrv
r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsFqdnSrv.
dnsxIsWild
r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsFqdnWildcard.
dnsxIsLbl
r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsLabel.
dnsxIsPtr
r00t2.io/goutils/tplx/sprigx/netx/dnsx.IsPtr.
numFloat32Str
numFloat64
numFloat64Str
numFloatStr
osFQDN
os.Hostname.
os.Hostname, use [`osHostname`](#fn_os_hstnm).
osGroupById
os/user.Group from a given group ID/GID.
os/user.LookupGroupId, except it will accept either a `string` **or** an `int` as the GID.
osGroupByName
os/user.Group from a given group name.
os/user.LookupGroup.
osHost
os.Hostname and returning the first "host label" (as RFCs refer to it). This is commonly/colloquially called the "hostname" or "hostname without the domain part".
Tip
|
The |
os.Hostname, use [`osHostname`](#fn_os_hstnm).
osHostname
os.Hostname.
osIdState
r00t2.io/sysutils.IDState.
r00t2.io/sysutils.GetIDState.
Warning
|
This is more or less useless on Windows; it returns only a dummy struct for cross-platform compatibility. |
osUser
os/user.User.
os/user.Current.
osUserById
os/user.User from a given user ID/UID.
os/user.LookupId, except it will accept either a `string` **or** an `int` as the UID.
osUserByName
os/user.User from a given username.
os/user.Lookup.
path stdlib library and use a fixed `/` path separator.
pathJoin
path.Join.
Warning
|
If you are joining paths in a pipeline, you almost assuredly want |
pathPipeJoin
pathSliceJoin
Tip
|
The |
pathSlicePipeJoin
Tip
|
The |
pathSubJoin
path/filepath stdlib library, and use the OS-specific os.PathSeparator.
Warning
|
Take special note of the oddness around specifying Windows paths and drive letters in e.g. It is recommended to make use of |
osPathJoin
path/filepath.Join.
Warning
|
If you are joining paths in a pipeline, you almost assuredly want |
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathPipeJoin
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSep
os.PathSeparator for this OS.
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSliceJoin
Tip
|
The |
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSlicePipeJoin
Tip
|
The |
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
osPathSubJoin
| OS | Result |
|---|---|
Windows |
|
Others (e.g. Linux, macOS) |
|
github.com/shirou/gopsutil/v4 packages.
psCpuCnts
github.com/shirou/gopsutil/v4/cpu.Counts.
psCpuInfo
github.com/shirou/gopsutil/v4/cpu.Info.
psCpuPct
github.com/shirou/gopsutil/v4/cpu.Percent.
psCpuTimes
github.com/shirou/gopsutil/v4/cpu.Times.
psDiskIoCnts
github.com/shirou/gopsutil/v4/disk.IOCounters.
psDiskLabel
github.com/shirou/gopsutil/v4/disk.Label.
psDiskParts
github.com/shirou/gopsutil/v4/disk.Partitions.
psDiskSerial
github.com/shirou/gopsutil/v4/disk.SerialNumber.
psDiskUsage
github.com/shirou/gopsutil/v4/disk.Usage.
psHostBoot
github.com/shirou/gopsutil/v4/host.BootTime.
psHostId
github.com/shirou/gopsutil/v4/host.HostID.
psHostInfo
github.com/shirou/gopsutil/v4/host.Info.
psHostKernArch
github.com/shirou/gopsutil/v4/host.KernelArch.
psHostKernVer
github.com/shirou/gopsutil/v4/host.KernelVersion.
psHostPlatInfo
github.com/shirou/gopsutil/v4/host.PlatformInformation.
psHostPlatUptime
github.com/shirou/gopsutil/v4/host.Uptime.
psHostUsers
github.com/shirou/gopsutil/v4/host.Users.
psHostPlatVirt
github.com/shirou/gopsutil/v4/host.Virtualization.
psLoadAvg
github.com/shirou/gopsutil/v4/load.Avg.
psLoadMisc
github.com/shirou/gopsutil/v4/load.Misc.
psMemExVMem
Warning
|
This function is available on Windows and Linux platforms only. |
Warning
|
This function returns very different types depending on platform.
|
psMemSwap
github.com/shirou/gopsutil/v4/mem.SwapMemory.
psMemSwapDevs
github.com/shirou/gopsutil/v4/mem.SwapDevices.
psMemVMem
github.com/shirou/gopsutil/v4/mem.VirtualMemory.
psNetConns
github.com/shirou/gopsutil/v4/net.Connections.
psNetConnsMax
github.com/shirou/gopsutil/v4/net.ConnectionsMax.
psNetConnsPid
github.com/shirou/gopsutil/v4/net.ConnectionsPid.
psNetConnsPidMax
github.com/shirou/gopsutil/v4/net.ConnectionsPidMax.
psNetCTStats
github.com/shirou/gopsutil/v4/net.ConntrackStats.
psNetCTStatList
github.com/shirou/gopsutil/v4/net.ConntrackStatList.
psNetFilterCnts
github.com/shirou/gopsutil/v4/net.FilterCounters.
psNetIoCnts
github.com/shirou/gopsutil/v4/net.IOCounters.
psNetIoCntsFile
github.com/shirou/gopsutil/v4/net.IOCountersByFile.
psNetIfaces
github.com/shirou/gopsutil/v4/net.Interfaces.
psNetPids
github.com/shirou/gopsutil/v4/net.Pids.
psNetProtoCnt
Warning
|
This only works properly on Linux currently per upstream. |
github.com/shirou/gopsutil/v4/net.ProtoCounters.
psNetRev
Warning
|
This function only exists on Linux. |
github.com/shirou/gopsutil/v4/net.Reverse.
psProcs
github.com/shirou/gopsutil/v4/proc.Processes.
psProcNew
github.com/shirou/gopsutil/v4/proc.NewProcess.
psProcPids
github.com/shirou/gopsutil/v4/proc.Pids.
psProcPidExists
github.com/shirou/gopsutil/v4/proc.PidExists.
psSensorExTemp
Warning
|
This function only exists on Linux. |
psSensorTemps
github.com/shirou/gopsutil/v4/sensors.SensorsTemperatures.
Warning
|
All of these functions are only available on Windows. |
psWinsvcList
Warning
|
This function is only available on Windows. |
github.com/shirou/gopsutil/v4/winservices.ListServices.
psWinsvcNew
Warning
|
This function is only available on Windows. |
github.com/shirou/gopsutil/v4/winservices.NewService.
extIndent
Tip
|
If |
| Argument | Type | Description |
|---|---|---|
|
|
The level of indentation for the text. If less than or equal to |
|
|
If true, skip indenting the first line. This is particularly handy if you like to visually align your function calls in your templates. |
|
|
If true, do not add an indent to empty lines (where an "empty line" means "only has a linebreak"). |
|
|
If true, do not add an indent to lines that only consist of whitespace (spaces, tabs, etc.) and a linebreak. |
|
|
The string to use as the "indent character". This can be any string, such as |
|
|
The text to be indented. Because it is the last argument, |
r00t2.io/goutils/stringsx
r00t2.io/goutils/stringsx.
strsxIsAscii
r00t2.io/goutils/tplx/sprigx/stringsx.IsAscii.
strsxIsAsciiBuf
r00t2.io/goutils/tplx/sprigx/stringsx.IsAsciiBuf.
strsxIsAsciiSpcl
r00t2.io/goutils/tplx/sprigx/stringsx.IsAsciiSpecial.
strsxIsAsciiBufSpcl
r00t2.io/goutils/tplx/sprigx/stringsx.IsAsciiSpecial.
strsxLenSpl
r00t2.io/goutils/tplx/sprigx/stringsx.LenSplit.
strsxLenSplStr
r00t2.io/goutils/tplx/sprigx/stringsx.LenSplitStr.
strsxPad
r00t2.io/goutils/tplx/sprigx/stringsx.Pad.
strsxRedact
r00t2.io/goutils/tplx/sprigx/stringsx.Redact.
strsxRev
r00t2.io/goutils/tplx/sprigx/stringsx.Reverse.
strsxTrimLns
r00t2.io/goutils/tplx/sprigx/stringsx.TrimLines.
strsxTrimSpcLft
r00t2.io/goutils/tplx/sprigx/stringsx.TrimSpaceLeft.
strsxTrimSpcRt
r00t2.io/goutils/tplx/sprigx/stringsx.TrimSpaceRight.
sysArch
runtime.GOARCH constant.
sysNumCpu
runtime.NumCPU.
sysOsName
runtime.GOOS constant.
sysRuntime
runtime stdlib library.
Tip
|
The value type is a direct link to the Because all values are mapped as strings, they can be converted back to their native type via e.g. the Sprig conversion functions if necessary. |
Note
|
Some of these functions duplicate Sprig functionality, but are included here for predictable API. Care has been taken to name these functions differently from the Sprig functions where possible and sensible. |
tmDate
time.Date.
tmFloatMicro
(r00t2.io/goutils/timex).F64Microseconds.
tmFloatMilli
(r00t2.io/goutils/timex).F64Milliseconds.
tmFloatNano
(r00t2.io/goutils/timex).F64Nanoseconds.
tmFloat
(r00t2.io/goutils/timex).F64Seconds.
tmFmt
tmNow
time.Now.
tmParseDur8n
time.ParseDuration.
tmParseMonth
tmParseMonthInt
time.Month. `n` may be any numeric type or a string representation of a number (or a custom type derived from those).
time.Month constants in the `time` module:
time.Now).
errors.Is; it will be wrapped by [`(text/template).ExecError`](https://pkg.go.dev/text/template#ExecError)/[`(html/template).ExecError`](https://pkg.go.dev/html/template#ExecError).
tmParseMonthStr
time.Month.
time.Now).
tmParseTime
time.Parse.
r00t2.io/sysutils/envs funcs
golang.org/x/sys/unix and golang.org/x/sys/windows (and its subpackages).
golang.org/x/sys/unix.Stat_t and/or golang.org/x/sys/unix.Statx_t, or a golang.org/x/sys/windows.Win32FileAttributeData).
encoding/hex)
r00t2.io/goutils/encodingx/hexx)
- `b64*` functions (encoding/base64)
github.com/google/uuid
- `uuidx*` functions for r00t2.io/goutils/uuidx
net/url functions to derive URLs.
net)
net/http.Request
- `httpresty.dev/v3?