funcs

package
v3.11.7 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 53 Imported by: 1

Documentation

Overview

Package funcs is an internal package that provides gomplate namespaces and functions to be used in 'text/template' templates.

The different namespaces can be added individually:

f := template.FuncMap{}
for k, v := range funcs.CreateMathFuncs(ctx) {
	f[k] = v
}
for k, v := range funcs.CreateNetFuncs(ctx) {
	f[k] = v
}

Even though the functions are exported, these are not intended to be called programmatically by external consumers, but instead only to be used as template functions.

Deprecated: This package will be made internal in a future major version.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWSFuncs

func AWSFuncs(f map[string]interface{})

AWSFuncs - Deprecated: use CreateAWSFuncs instead

func AddBase64Funcs

func AddBase64Funcs(f map[string]interface{})

AddBase64Funcs - Deprecated: use CreateBase64Funcs instead

func AddCollFuncs

func AddCollFuncs(f map[string]interface{})

AddCollFuncs - Deprecated: use CreateCollFuncs instead

func AddConvFuncs

func AddConvFuncs(f map[string]interface{})

AddConvFuncs - Deprecated: use CreateConvFuncs instead

func AddCryptoFuncs

func AddCryptoFuncs(f map[string]interface{})

AddCryptoFuncs - Deprecated: use CreateCryptoFuncs instead

func AddDataFuncs

func AddDataFuncs(f map[string]interface{}, d *data.Data)

AddDataFuncs - Deprecated: use CreateDataFuncs instead

func AddEnvFuncs

func AddEnvFuncs(f map[string]interface{})

AddEnvFuncs - Deprecated: use CreateEnvFuncs instead

func AddFileFuncs

func AddFileFuncs(f map[string]interface{})

AddFileFuncs - Deprecated: use CreateFileFuncs instead

func AddFilePathFuncs

func AddFilePathFuncs(f map[string]interface{})

AddFilePathFuncs - Deprecated: use CreateFilePathFuncs instead

func AddGCPFuncs added in v3.8.0

func AddGCPFuncs(f map[string]interface{})

AddGCPFuncs - Deprecated: use CreateGCPFuncs instead

func AddMathFuncs

func AddMathFuncs(f map[string]interface{})

AddMathFuncs - Deprecated: use CreateMathFuncs instead

func AddNetFuncs

func AddNetFuncs(f map[string]interface{})

AddNetFuncs - Deprecated: use CreateNetFuncs instead

func AddPathFuncs

func AddPathFuncs(f map[string]interface{})

AddPathFuncs - Deprecated: use CreatePathFuncs instead

func AddRandomFuncs

func AddRandomFuncs(f map[string]interface{})

AddRandomFuncs - Deprecated: use CreateRandomFuncs instead

func AddReFuncs

func AddReFuncs(f map[string]interface{})

AddReFuncs - Deprecated: use CreateReFuncs instead

func AddSockaddrFuncs

func AddSockaddrFuncs(f map[string]interface{})

AddSockaddrFuncs - Deprecated: use CreateSockaddrFuncs instead

func AddStringFuncs

func AddStringFuncs(f map[string]interface{})

AddStringFuncs - Deprecated: use CreateStringFuncs instead

func AddTestFuncs

func AddTestFuncs(f map[string]interface{})

AddTestFuncs - Deprecated: use CreateTestFuncs instead

func AddTimeFuncs

func AddTimeFuncs(f map[string]interface{})

AddTimeFuncs - Deprecated: use CreateTimeFuncs instead

func AddUUIDFuncs

func AddUUIDFuncs(f map[string]interface{})

AddUUIDFuncs - Deprecated: use CreateUUIDFuncs instead

func CreateAWSFuncs added in v3.8.0

func CreateAWSFuncs(ctx context.Context) map[string]interface{}

CreateAWSFuncs -

func CreateBase64Funcs added in v3.8.0

func CreateBase64Funcs(ctx context.Context) map[string]interface{}

CreateBase64Funcs -

func CreateCollFuncs added in v3.8.0

func CreateCollFuncs(ctx context.Context) map[string]interface{}

CreateCollFuncs -

func CreateConvFuncs added in v3.8.0

func CreateConvFuncs(ctx context.Context) map[string]interface{}

CreateConvFuncs -

func CreateCryptoFuncs added in v3.8.0

func CreateCryptoFuncs(ctx context.Context) map[string]interface{}

CreateCryptoFuncs -

func CreateDataFuncs added in v3.8.0

func CreateDataFuncs(ctx context.Context, d *data.Data) map[string]interface{}

CreateDataFuncs -

func CreateEnvFuncs added in v3.8.0

func CreateEnvFuncs(ctx context.Context) map[string]interface{}

CreateEnvFuncs -

func CreateFileFuncs added in v3.8.0

func CreateFileFuncs(ctx context.Context) map[string]interface{}

CreateFileFuncs -

func CreateFilePathFuncs added in v3.8.0

func CreateFilePathFuncs(ctx context.Context) map[string]interface{}

CreateFilePathFuncs -

func CreateGCPFuncs added in v3.8.0

func CreateGCPFuncs(ctx context.Context) map[string]interface{}

CreateGCPFuncs -

func CreateMathFuncs added in v3.8.0

func CreateMathFuncs(ctx context.Context) map[string]interface{}

CreateMathFuncs -

func CreateNetFuncs added in v3.8.0

func CreateNetFuncs(ctx context.Context) map[string]interface{}

CreateNetFuncs -

func CreatePathFuncs added in v3.8.0

func CreatePathFuncs(ctx context.Context) map[string]interface{}

CreatePathFuncs -

func CreateRandomFuncs added in v3.8.0

func CreateRandomFuncs(ctx context.Context) map[string]interface{}

CreateRandomFuncs -

func CreateReFuncs added in v3.8.0

func CreateReFuncs(ctx context.Context) map[string]interface{}

CreateReFuncs -

func CreateSockaddrFuncs added in v3.8.0

func CreateSockaddrFuncs(ctx context.Context) map[string]interface{}

CreateSockaddrFuncs -

func CreateStringFuncs added in v3.8.0

func CreateStringFuncs(ctx context.Context) map[string]interface{}

CreateStringFuncs -

func CreateTestFuncs added in v3.8.0

func CreateTestFuncs(ctx context.Context) map[string]interface{}

CreateTestFuncs -

func CreateTimeFuncs added in v3.8.0

func CreateTimeFuncs(ctx context.Context) map[string]interface{}

CreateTimeFuncs -

func CreateUUIDFuncs added in v3.8.0

func CreateUUIDFuncs(ctx context.Context) map[string]interface{}

CreateUUIDFuncs -

Types

type Base64Funcs

type Base64Funcs struct {
	// contains filtered or unexported fields
}

Base64Funcs -

func Base64NS

func Base64NS() *Base64Funcs

Base64NS - the base64 namespace Deprecated: don't use

func (Base64Funcs) Decode

func (Base64Funcs) Decode(in interface{}) (string, error)

Decode -

func (Base64Funcs) DecodeBytes added in v3.8.0

func (Base64Funcs) DecodeBytes(in interface{}) ([]byte, error)

DecodeBytes -

func (Base64Funcs) Encode

func (Base64Funcs) Encode(in interface{}) (string, error)

Encode -

type CollFuncs

type CollFuncs struct {
	// contains filtered or unexported fields
}

CollFuncs -

func CollNS

func CollNS() *CollFuncs

CollNS - Deprecated: don't use

func (CollFuncs) Append

func (CollFuncs) Append(v interface{}, list interface{}) ([]interface{}, error)

Append -

func (CollFuncs) Dict

func (CollFuncs) Dict(in ...interface{}) (map[string]interface{}, error)

Dict -

func (CollFuncs) Flatten

func (CollFuncs) Flatten(args ...interface{}) ([]interface{}, error)

Flatten -

func (CollFuncs) Has

func (CollFuncs) Has(in interface{}, key string) bool

Has -

func (CollFuncs) JSONPath

func (CollFuncs) JSONPath(p string, in interface{}) (interface{}, error)

JSONPath -

func (CollFuncs) Keys

func (CollFuncs) Keys(in ...map[string]interface{}) ([]string, error)

Keys -

func (CollFuncs) Merge

func (CollFuncs) Merge(dst map[string]interface{}, src ...map[string]interface{}) (map[string]interface{}, error)

Merge -

func (CollFuncs) Omit added in v3.7.0

func (CollFuncs) Omit(args ...interface{}) (map[string]interface{}, error)

Omit -

func (CollFuncs) Pick added in v3.7.0

func (CollFuncs) Pick(args ...interface{}) (map[string]interface{}, error)

Pick -

func (CollFuncs) Prepend

func (CollFuncs) Prepend(v interface{}, list interface{}) ([]interface{}, error)

Prepend -

func (CollFuncs) Reverse

func (CollFuncs) Reverse(in interface{}) ([]interface{}, error)

Reverse -

func (CollFuncs) Slice

func (CollFuncs) Slice(args ...interface{}) []interface{}

Slice -

func (CollFuncs) Sort

func (CollFuncs) Sort(args ...interface{}) ([]interface{}, error)

Sort -

func (CollFuncs) Uniq

func (CollFuncs) Uniq(in interface{}) ([]interface{}, error)

Uniq -

func (CollFuncs) Values

func (CollFuncs) Values(in ...map[string]interface{}) ([]interface{}, error)

Values -

type ConvFuncs

type ConvFuncs struct {
	// contains filtered or unexported fields
}

ConvFuncs -

func ConvNS

func ConvNS() *ConvFuncs

ConvNS - Deprecated: don't use

func (ConvFuncs) Atoi

func (ConvFuncs) Atoi(s interface{}) int

Atoi -

func (*ConvFuncs) Bool

func (f *ConvFuncs) Bool(s interface{}) bool

Bool - Deprecated: use ToBool instead

func (ConvFuncs) Default

func (ConvFuncs) Default(def, in interface{}) interface{}

Default -

func (*ConvFuncs) Dict

func (f *ConvFuncs) Dict(in ...interface{}) (map[string]interface{}, error)

Dict - Deprecated: use coll.Dict instead

func (*ConvFuncs) Has

func (f *ConvFuncs) Has(in interface{}, key string) bool

Has - Deprecated: use coll.Has instead

func (ConvFuncs) Join

func (ConvFuncs) Join(in interface{}, sep string) (string, error)

Join -

func (ConvFuncs) ParseFloat

func (ConvFuncs) ParseFloat(s interface{}, bitSize int) float64

ParseFloat -

func (ConvFuncs) ParseInt

func (ConvFuncs) ParseInt(s interface{}, base, bitSize int) int64

ParseInt -

func (ConvFuncs) ParseUint

func (ConvFuncs) ParseUint(s interface{}, base, bitSize int) uint64

ParseUint -

func (*ConvFuncs) Slice

func (f *ConvFuncs) Slice(args ...interface{}) []interface{}

Slice - Deprecated: use coll.Slice instead

func (ConvFuncs) ToBool

func (ConvFuncs) ToBool(in interface{}) bool

ToBool -

func (ConvFuncs) ToBools

func (ConvFuncs) ToBools(in ...interface{}) []bool

ToBools -

func (ConvFuncs) ToFloat64

func (ConvFuncs) ToFloat64(in interface{}) float64

ToFloat64 -

func (ConvFuncs) ToFloat64s

func (ConvFuncs) ToFloat64s(in ...interface{}) []float64

ToFloat64s -

func (ConvFuncs) ToInt

func (ConvFuncs) ToInt(in interface{}) int

ToInt -

func (ConvFuncs) ToInt64

func (ConvFuncs) ToInt64(in interface{}) int64

ToInt64 -

func (ConvFuncs) ToInt64s

func (ConvFuncs) ToInt64s(in ...interface{}) []int64

ToInt64s -

func (ConvFuncs) ToInts

func (ConvFuncs) ToInts(in ...interface{}) []int

ToInts -

func (ConvFuncs) ToString

func (ConvFuncs) ToString(in interface{}) string

ToString -

func (ConvFuncs) ToStrings

func (ConvFuncs) ToStrings(in ...interface{}) []string

ToStrings -

func (ConvFuncs) URL

func (ConvFuncs) URL(s interface{}) (*url.URL, error)

URL -

type CryptoFuncs

type CryptoFuncs struct {
	// contains filtered or unexported fields
}

CryptoFuncs -

func CryptoNS

func CryptoNS() *CryptoFuncs

CryptoNS - the crypto namespace Deprecated: don't use

func (CryptoFuncs) Bcrypt

func (CryptoFuncs) Bcrypt(args ...interface{}) (string, error)

Bcrypt -

func (*CryptoFuncs) DecryptAES added in v3.11.0

func (f *CryptoFuncs) DecryptAES(key string, args ...interface{}) (string, error)

DecryptAES - Experimental!

func (*CryptoFuncs) DecryptAESBytes added in v3.11.0

func (f *CryptoFuncs) DecryptAESBytes(key string, args ...interface{}) ([]byte, error)

DecryptAESBytes - Experimental!

func (*CryptoFuncs) ECDSADerivePublicKey added in v3.11.0

func (f *CryptoFuncs) ECDSADerivePublicKey(privateKey string) (string, error)

ECDSADerivePublicKey - Experimental!

func (*CryptoFuncs) ECDSAGenerateKey added in v3.11.0

func (f *CryptoFuncs) ECDSAGenerateKey(args ...interface{}) (string, error)

ECDSAGenerateKey - Experimental!

func (*CryptoFuncs) EncryptAES added in v3.11.0

func (f *CryptoFuncs) EncryptAES(key string, args ...interface{}) ([]byte, error)

EncryptAES - Experimental!

func (CryptoFuncs) PBKDF2

func (CryptoFuncs) PBKDF2(password, salt, iter, keylen interface{}, hashFunc ...string) (k string, err error)

PBKDF2 - Run the Password-Based Key Derivation Function #2 as defined in RFC 2898 (PKCS #5 v2.0). This function outputs the binary result in hex format.

func (*CryptoFuncs) RSADecrypt added in v3.8.0

func (f *CryptoFuncs) RSADecrypt(key string, in []byte) (string, error)

RSADecrypt - Experimental!

func (*CryptoFuncs) RSADecryptBytes added in v3.8.0

func (f *CryptoFuncs) RSADecryptBytes(key string, in []byte) ([]byte, error)

RSADecryptBytes - Experimental!

func (*CryptoFuncs) RSADerivePublicKey added in v3.8.0

func (f *CryptoFuncs) RSADerivePublicKey(privateKey string) (string, error)

RSADerivePublicKey - Experimental!

func (*CryptoFuncs) RSAEncrypt added in v3.8.0

func (f *CryptoFuncs) RSAEncrypt(key string, in interface{}) ([]byte, error)

RSAEncrypt - Experimental!

func (*CryptoFuncs) RSAGenerateKey added in v3.8.0

func (f *CryptoFuncs) RSAGenerateKey(args ...interface{}) (string, error)

RSAGenerateKey - Experimental!

func (CryptoFuncs) SHA1

func (f CryptoFuncs) SHA1(input interface{}) string

SHA1 - Note: SHA-1 is cryptographically broken and should not be used for secure applications.

func (CryptoFuncs) SHA1Bytes added in v3.11.0

func (CryptoFuncs) SHA1Bytes(input interface{}) ([]byte, error)

SHA1 - Note: SHA-1 is cryptographically broken and should not be used for secure applications.

func (CryptoFuncs) SHA224

func (f CryptoFuncs) SHA224(input interface{}) string

SHA224 -

func (CryptoFuncs) SHA224Bytes added in v3.11.0

func (CryptoFuncs) SHA224Bytes(input interface{}) ([]byte, error)

SHA224 -

func (CryptoFuncs) SHA256

func (f CryptoFuncs) SHA256(input interface{}) string

SHA256 -

func (CryptoFuncs) SHA256Bytes added in v3.11.0

func (CryptoFuncs) SHA256Bytes(input interface{}) ([]byte, error)

SHA256 -

func (CryptoFuncs) SHA384

func (f CryptoFuncs) SHA384(input interface{}) string

SHA384 -

func (CryptoFuncs) SHA384Bytes added in v3.11.0

func (CryptoFuncs) SHA384Bytes(input interface{}) ([]byte, error)

SHA384 -

func (CryptoFuncs) SHA512

func (f CryptoFuncs) SHA512(input interface{}) string

SHA512 -

func (CryptoFuncs) SHA512Bytes added in v3.11.0

func (CryptoFuncs) SHA512Bytes(input interface{}) ([]byte, error)

SHA512 -

func (CryptoFuncs) SHA512_224

func (f CryptoFuncs) SHA512_224(input interface{}) string

SHA512_224 -

func (CryptoFuncs) SHA512_224Bytes added in v3.11.0

func (CryptoFuncs) SHA512_224Bytes(input interface{}) ([]byte, error)

SHA512_224 -

func (CryptoFuncs) SHA512_256

func (f CryptoFuncs) SHA512_256(input interface{}) string

SHA512_256 -

func (CryptoFuncs) SHA512_256Bytes added in v3.11.0

func (CryptoFuncs) SHA512_256Bytes(input interface{}) ([]byte, error)

SHA512_256 -

func (CryptoFuncs) WPAPSK

func (f CryptoFuncs) WPAPSK(ssid, password interface{}) (string, error)

WPAPSK - Convert an ASCII passphrase to WPA PSK for a given SSID

type DataFuncs

type DataFuncs struct {
	// contains filtered or unexported fields
}

DataFuncs -

func DataNS

func DataNS() *DataFuncs

DataNS - Deprecated: don't use

func (*DataFuncs) CSV

func (f *DataFuncs) CSV(args ...string) ([][]string, error)

CSV -

func (*DataFuncs) CSVByColumn

func (f *DataFuncs) CSVByColumn(args ...string) (cols map[string][]string, err error)

CSVByColumn -

func (*DataFuncs) CSVByRow

func (f *DataFuncs) CSVByRow(args ...string) (rows []map[string]string, err error)

CSVByRow -

func (*DataFuncs) JSON

func (f *DataFuncs) JSON(in interface{}) (map[string]interface{}, error)

JSON -

func (*DataFuncs) JSONArray

func (f *DataFuncs) JSONArray(in interface{}) ([]interface{}, error)

JSONArray -

func (*DataFuncs) TOML

func (f *DataFuncs) TOML(in interface{}) (interface{}, error)

TOML -

func (*DataFuncs) ToCSV

func (f *DataFuncs) ToCSV(args ...interface{}) (string, error)

ToCSV -

func (*DataFuncs) ToJSON

func (f *DataFuncs) ToJSON(in interface{}) (string, error)

ToJSON -

func (*DataFuncs) ToJSONPretty

func (f *DataFuncs) ToJSONPretty(indent string, in interface{}) (string, error)

ToJSONPretty -

func (*DataFuncs) ToTOML

func (f *DataFuncs) ToTOML(in interface{}) (string, error)

ToTOML -

func (*DataFuncs) ToYAML

func (f *DataFuncs) ToYAML(in interface{}) (string, error)

ToYAML -

func (*DataFuncs) YAML

func (f *DataFuncs) YAML(in interface{}) (map[string]interface{}, error)

YAML -

func (*DataFuncs) YAMLArray

func (f *DataFuncs) YAMLArray(in interface{}) ([]interface{}, error)

YAMLArray -

type EnvFuncs

type EnvFuncs struct {
	// contains filtered or unexported fields
}

EnvFuncs -

func EnvNS

func EnvNS() *EnvFuncs

EnvNS - the Env namespace Deprecated: don't use

func (EnvFuncs) ExpandEnv

func (EnvFuncs) ExpandEnv(s interface{}) string

ExpandEnv -

func (EnvFuncs) Getenv

func (EnvFuncs) Getenv(key interface{}, def ...string) string

Getenv -

type FileFuncs

type FileFuncs struct {
	// contains filtered or unexported fields
}

FileFuncs -

func FileNS

func FileNS() *FileFuncs

FileNS - the File namespace Deprecated: don't use

func (*FileFuncs) Exists

func (f *FileFuncs) Exists(path interface{}) bool

Exists -

func (*FileFuncs) IsDir

func (f *FileFuncs) IsDir(path interface{}) bool

IsDir -

func (*FileFuncs) Read

func (f *FileFuncs) Read(path interface{}) (string, error)

Read -

func (*FileFuncs) ReadDir

func (f *FileFuncs) ReadDir(path interface{}) ([]string, error)

ReadDir -

func (*FileFuncs) Stat

func (f *FileFuncs) Stat(path interface{}) (os.FileInfo, error)

Stat -

func (*FileFuncs) Walk

func (f *FileFuncs) Walk(path interface{}) ([]string, error)

Walk -

func (*FileFuncs) Write

func (f *FileFuncs) Write(path interface{}, data interface{}) (s string, err error)

Write -

type FilePathFuncs

type FilePathFuncs struct {
	// contains filtered or unexported fields
}

FilePathFuncs -

func FilePathNS

func FilePathNS() *FilePathFuncs

FilePathNS - the Path namespace Deprecated: don't use

func (*FilePathFuncs) Base

func (f *FilePathFuncs) Base(in interface{}) string

Base -

func (*FilePathFuncs) Clean

func (f *FilePathFuncs) Clean(in interface{}) string

Clean -

func (*FilePathFuncs) Dir

func (f *FilePathFuncs) Dir(in interface{}) string

Dir -

func (*FilePathFuncs) Ext

func (f *FilePathFuncs) Ext(in interface{}) string

Ext -

func (*FilePathFuncs) FromSlash

func (f *FilePathFuncs) FromSlash(in interface{}) string

FromSlash -

func (*FilePathFuncs) IsAbs

func (f *FilePathFuncs) IsAbs(in interface{}) bool

IsAbs -

func (*FilePathFuncs) Join

func (f *FilePathFuncs) Join(elem ...interface{}) string

Join -

func (*FilePathFuncs) Match

func (f *FilePathFuncs) Match(pattern, name interface{}) (matched bool, err error)

Match -

func (*FilePathFuncs) Rel

func (f *FilePathFuncs) Rel(basepath, targpath interface{}) (string, error)

Rel -

func (*FilePathFuncs) Split

func (f *FilePathFuncs) Split(in interface{}) []string

Split -

func (*FilePathFuncs) ToSlash

func (f *FilePathFuncs) ToSlash(in interface{}) string

ToSlash -

func (*FilePathFuncs) VolumeName

func (f *FilePathFuncs) VolumeName(in interface{}) string

VolumeName -

type Funcs

type Funcs struct {
	// contains filtered or unexported fields
}

Funcs -

func AWSNS

func AWSNS() *Funcs

AWSNS - the aws namespace Deprecated: don't use

func (*Funcs) ARN

func (a *Funcs) ARN() (string, error)

ARN - Gets the AWS ARN associated with the calling entity

func (*Funcs) Account

func (a *Funcs) Account() (string, error)

Account - Gets the AWS account ID number of the account that owns or contains the calling entity.

func (*Funcs) EC2Dynamic

func (a *Funcs) EC2Dynamic(key string, def ...string) (string, error)

EC2Dynamic -

func (*Funcs) EC2Meta

func (a *Funcs) EC2Meta(key string, def ...string) (string, error)

EC2Meta -

func (*Funcs) EC2Region

func (a *Funcs) EC2Region(def ...string) (string, error)

EC2Region -

func (*Funcs) EC2Tag

func (a *Funcs) EC2Tag(tag string, def ...string) (string, error)

EC2Tag -

func (*Funcs) EC2Tags added in v3.8.0

func (a *Funcs) EC2Tags() (map[string]string, error)

EC2Tag -

func (*Funcs) KMSDecrypt

func (a *Funcs) KMSDecrypt(ciphertext interface{}) (string, error)

KMSDecrypt -

func (*Funcs) KMSEncrypt

func (a *Funcs) KMSEncrypt(keyID, plaintext interface{}) (string, error)

KMSEncrypt -

func (*Funcs) UserID

func (a *Funcs) UserID() (string, error)

UserID - Gets the unique identifier of the calling entity. The exact value depends on the type of entity making the call. The values returned are those listed in the aws:userid column in the Principal table (http://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_variables.html#principaltable) found on the Policy Variables reference page in the IAM User Guide.

type GcpFuncs added in v3.8.0

type GcpFuncs struct {
	// contains filtered or unexported fields
}

GcpFuncs -

func GCPNS added in v3.8.0

func GCPNS() *GcpFuncs

GCPNS - the gcp namespace Deprecated: don't use

func (*GcpFuncs) Meta added in v3.8.0

func (a *GcpFuncs) Meta(key string, def ...string) (string, error)

Meta -

type MathFuncs

type MathFuncs struct {
	// contains filtered or unexported fields
}

MathFuncs -

func MathNS

func MathNS() *MathFuncs

MathNS - the math namespace Deprecated: don't use

func (MathFuncs) Abs

func (f MathFuncs) Abs(n interface{}) interface{}

Abs -

func (MathFuncs) Add

func (f MathFuncs) Add(n ...interface{}) interface{}

Add -

func (MathFuncs) Ceil

func (f MathFuncs) Ceil(n interface{}) interface{}

Ceil -

func (MathFuncs) Div

func (f MathFuncs) Div(a, b interface{}) (interface{}, error)

Div -

func (MathFuncs) Floor

func (f MathFuncs) Floor(n interface{}) interface{}

Floor -

func (MathFuncs) IsFloat

func (f MathFuncs) IsFloat(n interface{}) bool

IsFloat -

func (MathFuncs) IsInt

func (f MathFuncs) IsInt(n interface{}) bool

IsInt -

func (MathFuncs) IsNum

func (f MathFuncs) IsNum(n interface{}) bool

IsNum -

func (MathFuncs) Max

func (f MathFuncs) Max(a interface{}, b ...interface{}) (interface{}, error)

Max -

func (MathFuncs) Min

func (f MathFuncs) Min(a interface{}, b ...interface{}) (interface{}, error)

Min -

func (MathFuncs) Mul

func (f MathFuncs) Mul(n ...interface{}) interface{}

Mul -

func (MathFuncs) Pow

func (f MathFuncs) Pow(a, b interface{}) interface{}

Pow -

func (MathFuncs) Rem

func (f MathFuncs) Rem(a, b interface{}) interface{}

Rem -

func (MathFuncs) Round

func (f MathFuncs) Round(n interface{}) interface{}

Round -

func (MathFuncs) Seq

func (f MathFuncs) Seq(n ...interface{}) ([]int64, error)

Seq - return a sequence from `start` to `end`, in steps of `step` start and step are optional, and default to 1.

func (MathFuncs) Sub

func (f MathFuncs) Sub(a, b interface{}) interface{}

Sub -

type NetFuncs

type NetFuncs struct {
	// contains filtered or unexported fields
}

NetFuncs -

func NetNS

func NetNS() *NetFuncs

NetNS - the net namespace Deprecated: don't use

func (NetFuncs) CIDRHost added in v3.11.0

func (f NetFuncs) CIDRHost(hostnum interface{}, prefix interface{}) (netip.Addr, error)

CIDRHost - Experimental!

func (NetFuncs) CIDRNetmask added in v3.11.0

func (f NetFuncs) CIDRNetmask(prefix interface{}) (netip.Addr, error)

CIDRNetmask - Experimental!

func (NetFuncs) CIDRSubnetSizes added in v3.11.0

func (f NetFuncs) CIDRSubnetSizes(args ...interface{}) ([]netip.Prefix, error)

CIDRSubnetSizes - Experimental!

func (NetFuncs) CIDRSubnets added in v3.11.0

func (f NetFuncs) CIDRSubnets(newbits interface{}, prefix interface{}) ([]netip.Prefix, error)

CIDRSubnets - Experimental!

func (NetFuncs) LookupCNAME

func (f NetFuncs) LookupCNAME(name interface{}) (string, error)

LookupCNAME -

func (NetFuncs) LookupIP

func (f NetFuncs) LookupIP(name interface{}) (string, error)

LookupIP -

func (NetFuncs) LookupIPs

func (f NetFuncs) LookupIPs(name interface{}) ([]string, error)

LookupIPs -

func (NetFuncs) LookupSRV

func (f NetFuncs) LookupSRV(name interface{}) (*stdnet.SRV, error)

LookupSRV -

func (NetFuncs) LookupSRVs

func (f NetFuncs) LookupSRVs(name interface{}) ([]*stdnet.SRV, error)

LookupSRVs -

func (NetFuncs) LookupTXT

func (f NetFuncs) LookupTXT(name interface{}) ([]string, error)

LookupTXT -

func (NetFuncs) ParseIP added in v3.10.0

func (f NetFuncs) ParseIP(ip interface{}) (netaddr.IP, error)

ParseIP -

func (NetFuncs) ParseIPPrefix added in v3.10.0

func (f NetFuncs) ParseIPPrefix(ipprefix interface{}) (netaddr.IPPrefix, error)

ParseIPPrefix -

func (NetFuncs) ParseIPRange added in v3.10.0

func (f NetFuncs) ParseIPRange(iprange interface{}) (netaddr.IPRange, error)

ParseIPRange -

type PathFuncs

type PathFuncs struct {
	// contains filtered or unexported fields
}

PathFuncs -

func PathNS

func PathNS() *PathFuncs

PathNS - the Path namespace Deprecated: don't use

func (PathFuncs) Base

func (PathFuncs) Base(in interface{}) string

Base -

func (PathFuncs) Clean

func (PathFuncs) Clean(in interface{}) string

Clean -

func (PathFuncs) Dir

func (PathFuncs) Dir(in interface{}) string

Dir -

func (PathFuncs) Ext

func (PathFuncs) Ext(in interface{}) string

Ext -

func (PathFuncs) IsAbs

func (PathFuncs) IsAbs(in interface{}) bool

IsAbs -

func (PathFuncs) Join

func (PathFuncs) Join(elem ...interface{}) string

Join -

func (PathFuncs) Match

func (PathFuncs) Match(pattern, name interface{}) (matched bool, err error)

Match -

func (PathFuncs) Split

func (PathFuncs) Split(in interface{}) []string

Split -

type RandomFuncs

type RandomFuncs struct {
	// contains filtered or unexported fields
}

RandomFuncs -

func RandomNS

func RandomNS() *RandomFuncs

RandomNS - Deprecated: don't use

func (RandomFuncs) ASCII

func (RandomFuncs) ASCII(count interface{}) (string, error)

ASCII -

func (RandomFuncs) Alpha

func (RandomFuncs) Alpha(count interface{}) (string, error)

Alpha -

func (RandomFuncs) AlphaNum

func (RandomFuncs) AlphaNum(count interface{}) (string, error)

AlphaNum -

func (RandomFuncs) Float

func (RandomFuncs) Float(args ...interface{}) (float64, error)

Float -

func (RandomFuncs) Item

func (RandomFuncs) Item(items interface{}) (interface{}, error)

Item -

func (RandomFuncs) Number

func (RandomFuncs) Number(args ...interface{}) (int64, error)

Number -

func (RandomFuncs) String

func (RandomFuncs) String(count interface{}, args ...interface{}) (s string, err error)

String -

type ReFuncs

type ReFuncs struct {
	// contains filtered or unexported fields
}

ReFuncs -

func ReNS

func ReNS() *ReFuncs

ReNS - Deprecated: don't use

func (ReFuncs) Find

func (ReFuncs) Find(re, input interface{}) (string, error)

Find -

func (ReFuncs) FindAll

func (ReFuncs) FindAll(args ...interface{}) ([]string, error)

FindAll -

func (ReFuncs) Match

func (ReFuncs) Match(re, input interface{}) bool

Match -

func (ReFuncs) QuoteMeta added in v3.7.0

func (ReFuncs) QuoteMeta(in interface{}) string

QuoteMeta -

func (ReFuncs) Replace

func (ReFuncs) Replace(re, replacement, input interface{}) string

Replace -

func (ReFuncs) ReplaceLiteral

func (ReFuncs) ReplaceLiteral(re, replacement, input interface{}) (string, error)

ReplaceLiteral -

func (ReFuncs) Split

func (ReFuncs) Split(args ...interface{}) ([]string, error)

Split -

type SockaddrFuncs

type SockaddrFuncs struct {
	// contains filtered or unexported fields
}

SockaddrFuncs -

func SockaddrNS

func SockaddrNS() *SockaddrFuncs

SockaddrNS - the sockaddr namespace Deprecated: don't use

func (SockaddrFuncs) Attr

func (SockaddrFuncs) Attr(selectorName string, ifAddrsRaw interface{}) (string, error)

Attr -

func (SockaddrFuncs) Exclude

func (SockaddrFuncs) Exclude(selectorName, selectorParam string, inputIfAddrs sockaddr.IfAddrs) (sockaddr.IfAddrs, error)

Exclude -

func (SockaddrFuncs) GetAllInterfaces

func (SockaddrFuncs) GetAllInterfaces() (sockaddr.IfAddrs, error)

GetAllInterfaces -

func (SockaddrFuncs) GetDefaultInterfaces

func (SockaddrFuncs) GetDefaultInterfaces() (sockaddr.IfAddrs, error)

GetDefaultInterfaces -

func (SockaddrFuncs) GetInterfaceIP

func (SockaddrFuncs) GetInterfaceIP(namedIfRE string) (string, error)

GetInterfaceIP -

func (SockaddrFuncs) GetInterfaceIPs

func (SockaddrFuncs) GetInterfaceIPs(namedIfRE string) (string, error)

GetInterfaceIPs -

func (SockaddrFuncs) GetPrivateIP

func (SockaddrFuncs) GetPrivateIP() (string, error)

GetPrivateIP -

func (SockaddrFuncs) GetPrivateIPs

func (SockaddrFuncs) GetPrivateIPs() (string, error)

GetPrivateIPs -

func (SockaddrFuncs) GetPrivateInterfaces

func (SockaddrFuncs) GetPrivateInterfaces() (sockaddr.IfAddrs, error)

GetPrivateInterfaces -

func (SockaddrFuncs) GetPublicIP

func (SockaddrFuncs) GetPublicIP() (string, error)

GetPublicIP -

func (SockaddrFuncs) GetPublicIPs

func (SockaddrFuncs) GetPublicIPs() (string, error)

GetPublicIPs -

func (SockaddrFuncs) GetPublicInterfaces

func (SockaddrFuncs) GetPublicInterfaces() (sockaddr.IfAddrs, error)

GetPublicInterfaces -

func (SockaddrFuncs) Include

func (SockaddrFuncs) Include(selectorName, selectorParam string, inputIfAddrs sockaddr.IfAddrs) (sockaddr.IfAddrs, error)

Include -

func (SockaddrFuncs) Join

func (SockaddrFuncs) Join(selectorName, joinString string, inputIfAddrs sockaddr.IfAddrs) (string, error)

Join -

func (SockaddrFuncs) Limit

func (SockaddrFuncs) Limit(lim uint, in sockaddr.IfAddrs) (sockaddr.IfAddrs, error)

Limit -

func (SockaddrFuncs) Math

func (SockaddrFuncs) Math(operation, value string, inputIfAddrs sockaddr.IfAddrs) (sockaddr.IfAddrs, error)

Math -

func (SockaddrFuncs) Offset

func (SockaddrFuncs) Offset(off int, in sockaddr.IfAddrs) (sockaddr.IfAddrs, error)

Offset -

func (SockaddrFuncs) Sort

func (SockaddrFuncs) Sort(selectorParam string, inputIfAddrs sockaddr.IfAddrs) (sockaddr.IfAddrs, error)

Sort -

func (SockaddrFuncs) Unique

func (SockaddrFuncs) Unique(selectorName string, inputIfAddrs sockaddr.IfAddrs) (sockaddr.IfAddrs, error)

Unique -

type StringFuncs

type StringFuncs struct {
	// contains filtered or unexported fields
}

StringFuncs -

func StrNS

func StrNS() *StringFuncs

StrNS - Deprecated: don't use

func (StringFuncs) Abbrev

func (StringFuncs) Abbrev(args ...interface{}) (string, error)

Abbrev -

func (StringFuncs) CamelCase

func (StringFuncs) CamelCase(in interface{}) (string, error)

CamelCase -

func (StringFuncs) Contains

func (StringFuncs) Contains(substr string, s interface{}) bool

Contains -

func (StringFuncs) HasPrefix

func (StringFuncs) HasPrefix(prefix string, s interface{}) bool

HasPrefix -

func (StringFuncs) HasSuffix

func (StringFuncs) HasSuffix(suffix string, s interface{}) bool

HasSuffix -

func (StringFuncs) Indent

func (StringFuncs) Indent(args ...interface{}) (string, error)

Indent -

func (StringFuncs) KebabCase

func (StringFuncs) KebabCase(in interface{}) (string, error)

KebabCase -

func (StringFuncs) Quote

func (StringFuncs) Quote(in interface{}) string

Quote -

func (StringFuncs) Repeat

func (StringFuncs) Repeat(count int, s interface{}) (string, error)

Repeat -

func (StringFuncs) ReplaceAll

func (StringFuncs) ReplaceAll(old, new string, s interface{}) string

ReplaceAll -

func (StringFuncs) RuneCount

func (StringFuncs) RuneCount(args ...interface{}) (int, error)

RuneCount - like len(s), but for runes

func (StringFuncs) ShellQuote

func (StringFuncs) ShellQuote(in interface{}) string

ShellQuote -

func (StringFuncs) Slug

func (StringFuncs) Slug(in interface{}) string

Slug -

func (StringFuncs) SnakeCase

func (StringFuncs) SnakeCase(in interface{}) (string, error)

SnakeCase -

func (*StringFuncs) Sort deprecated

func (f *StringFuncs) Sort(list interface{}) ([]string, error)

Sort -

Deprecated: use coll.Sort instead

func (StringFuncs) Split

func (StringFuncs) Split(sep string, s interface{}) []string

Split -

func (StringFuncs) SplitN

func (StringFuncs) SplitN(sep string, n int, s interface{}) []string

SplitN -

func (StringFuncs) Squote

func (StringFuncs) Squote(in interface{}) string

Squote -

func (*StringFuncs) Title

func (f *StringFuncs) Title(s interface{}) string

Title -

func (*StringFuncs) ToLower

func (f *StringFuncs) ToLower(s interface{}) string

ToLower -

func (*StringFuncs) ToUpper

func (f *StringFuncs) ToUpper(s interface{}) string

ToUpper -

func (StringFuncs) Trim

func (StringFuncs) Trim(cutset string, s interface{}) string

Trim -

func (StringFuncs) TrimPrefix

func (StringFuncs) TrimPrefix(cutset string, s interface{}) string

TrimPrefix -

func (StringFuncs) TrimSpace

func (StringFuncs) TrimSpace(s interface{}) string

TrimSpace -

func (StringFuncs) TrimSuffix

func (StringFuncs) TrimSuffix(cutset string, s interface{}) string

TrimSuffix -

func (StringFuncs) Trunc

func (StringFuncs) Trunc(length int, s interface{}) string

Trunc -

func (StringFuncs) WordWrap

func (StringFuncs) WordWrap(args ...interface{}) (string, error)

WordWrap -

type TestFuncs

type TestFuncs struct {
	// contains filtered or unexported fields
}

TestFuncs -

func TestNS

func TestNS() *TestFuncs

TestNS - Deprecated: don't use

func (TestFuncs) Assert

func (TestFuncs) Assert(args ...interface{}) (string, error)

Assert -

func (TestFuncs) Fail

func (TestFuncs) Fail(args ...interface{}) (string, error)

Fail -

func (TestFuncs) IsKind added in v3.8.0

func (f TestFuncs) IsKind(kind string, arg interface{}) bool

IsKind - return whether or not the argument is of the given kind

func (TestFuncs) Kind added in v3.8.0

func (TestFuncs) Kind(arg interface{}) string

Kind - return the kind of the argument

func (TestFuncs) Required

func (TestFuncs) Required(args ...interface{}) (interface{}, error)

Required -

func (TestFuncs) Ternary

func (TestFuncs) Ternary(tval, fval, b interface{}) interface{}

Ternary -

type TimeFuncs

type TimeFuncs struct {
	ANSIC       string
	UnixDate    string
	RubyDate    string
	RFC822      string
	RFC822Z     string
	RFC850      string
	RFC1123     string
	RFC1123Z    string
	RFC3339     string
	RFC3339Nano string
	Kitchen     string
	Stamp       string
	StampMilli  string
	StampMicro  string
	StampNano   string
	// contains filtered or unexported fields
}

TimeFuncs -

func TimeNS

func TimeNS() *TimeFuncs

TimeNS - Deprecated: don't use

func (TimeFuncs) Hour

func (TimeFuncs) Hour(n interface{}) gotime.Duration

Hour -

func (TimeFuncs) Microsecond

func (TimeFuncs) Microsecond(n interface{}) gotime.Duration

Microsecond -

func (TimeFuncs) Millisecond

func (TimeFuncs) Millisecond(n interface{}) gotime.Duration

Millisecond -

func (TimeFuncs) Minute

func (TimeFuncs) Minute(n interface{}) gotime.Duration

Minute -

func (TimeFuncs) Nanosecond

func (TimeFuncs) Nanosecond(n interface{}) gotime.Duration

Nanosecond -

func (TimeFuncs) Now

func (TimeFuncs) Now() gotime.Time

Now -

func (TimeFuncs) Parse

func (TimeFuncs) Parse(layout string, value interface{}) (gotime.Time, error)

Parse -

func (TimeFuncs) ParseDuration

func (TimeFuncs) ParseDuration(n interface{}) (gotime.Duration, error)

ParseDuration -

func (TimeFuncs) ParseInLocation

func (TimeFuncs) ParseInLocation(layout, location string, value interface{}) (gotime.Time, error)

ParseInLocation -

func (TimeFuncs) ParseLocal

func (f TimeFuncs) ParseLocal(layout string, value interface{}) (gotime.Time, error)

ParseLocal -

func (TimeFuncs) Second

func (TimeFuncs) Second(n interface{}) gotime.Duration

Second -

func (TimeFuncs) Since

func (TimeFuncs) Since(n gotime.Time) gotime.Duration

Since -

func (TimeFuncs) Unix

func (TimeFuncs) Unix(in interface{}) (gotime.Time, error)

Unix - convert UNIX time (in seconds since the UNIX epoch) into a time.Time for further processing Takes a string or number (int or float)

func (TimeFuncs) Until

func (TimeFuncs) Until(n gotime.Time) gotime.Duration

Until -

func (TimeFuncs) ZoneName

func (TimeFuncs) ZoneName() string

ZoneName - return the local system's time zone's name

func (TimeFuncs) ZoneOffset

func (TimeFuncs) ZoneOffset() int

ZoneOffset - return the local system's time zone's name

type UUIDFuncs

type UUIDFuncs struct {
	// contains filtered or unexported fields
}

UUIDFuncs -

func UUIDNS

func UUIDNS() *UUIDFuncs

UUIDNS - Deprecated: don't use

func (UUIDFuncs) IsValid

func (f UUIDFuncs) IsValid(in interface{}) (bool, error)

IsValid - checks if the given UUID is in the correct format. It does not validate whether the version or variant are correct.

func (UUIDFuncs) Nil

func (UUIDFuncs) Nil() (string, error)

Nil -

func (UUIDFuncs) Parse

func (UUIDFuncs) Parse(in interface{}) (uuid.UUID, error)

Parse - parse a UUID for further manipulation or inspection.

Both the standard UUID forms of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx and urn:uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx are decoded as well as the Microsoft encoding {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} and the raw hex encoding: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.

func (UUIDFuncs) V1

func (UUIDFuncs) V1() (string, error)

V1 - return a version 1 UUID (based on the current MAC Address and the current date/time). Use V4 instead in most cases.

func (UUIDFuncs) V4

func (UUIDFuncs) V4() (string, error)

V4 - return a version 4 (random) UUID

Jump to

Keyboard shortcuts

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