Version: v0.9.0 Latest Latest

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

Go to latest
Published: Jul 23, 2022 License: Apache-2.0 Imports: 68 Imported by: 0




View Source
const (
	FuncID_LAST_Static_FUNC      = FuncID_uuid_Zero
	FuncID_LAST_Contextual_FUNC  = FuncID_yqObj
	FuncID_LAST_Placeholder_FUNC = FuncID_var
View Source
const (
	// start of static funcs
	FuncName_add                         = "add"
	FuncName_add1                        = "add1"
	FuncName_addPrefix                   = "addPrefix"
	FuncName_addSuffix                   = "addSuffix"
	FuncName_all                         = "all"
	FuncName_and                         = "and"
	FuncName_any                         = "any"
	FuncName_append                      = "append"
	FuncName_archconv                    = "archconv"
	FuncName_archconv_AlpineArch         = "archconv.AlpineArch"
	FuncName_archconv_AlpineTripleName   = "archconv.AlpineTripleName"
	FuncName_archconv_DebianArch         = "archconv.DebianArch"
	FuncName_archconv_DebianTripleName   = "archconv.DebianTripleName"
	FuncName_archconv_DockerArch         = "archconv.DockerArch"
	FuncName_archconv_DockerArchVariant  = "archconv.DockerArchVariant"
	FuncName_archconv_DockerHubArch      = "archconv.DockerHubArch"
	FuncName_archconv_DockerOS           = "archconv.DockerOS"
	FuncName_archconv_DockerPlatformArch = "archconv.DockerPlatformArch"
	FuncName_archconv_GNUArch            = "archconv.GNUArch"
	FuncName_archconv_GNUTripleName      = "archconv.GNUTripleName"
	FuncName_archconv_GolangArch         = "archconv.GolangArch"
	FuncName_archconv_GolangOS           = "archconv.GolangOS"
	FuncName_archconv_HF                 = "archconv.HF"
	FuncName_archconv_HardFloatArch      = "archconv.HardFloatArch"
	FuncName_archconv_LLVMArch           = "archconv.LLVMArch"
	FuncName_archconv_LLVMTripleName     = "archconv.LLVMTripleName"
	FuncName_archconv_OciArch            = "archconv.OciArch"
	FuncName_archconv_OciArchVariant     = "archconv.OciArchVariant"
	FuncName_archconv_OciOS              = "archconv.OciOS"
	FuncName_archconv_QemuArch           = "archconv.QemuArch"
	FuncName_archconv_SF                 = "archconv.SF"
	FuncName_archconv_SimpleArch         = "archconv.SimpleArch"
	FuncName_archconv_SoftFloatArch      = "archconv.SoftFloatArch"
	FuncName_base64                      = "base64"
	FuncName_call                        = "call"
	FuncName_close                       = "close"
	FuncName_coll                        = "coll"
	FuncName_coll_Append                 = "coll.Append"
	FuncName_coll_Bools                  = "coll.Bools"
	FuncName_coll_Dup                    = "coll.Dup"
	FuncName_coll_Flatten                = "coll.Flatten"
	FuncName_coll_Floats                 = "coll.Floats"
	FuncName_coll_HasAll                 = "coll.HasAll"
	FuncName_coll_HasAny                 = "coll.HasAny"
	FuncName_coll_Index                  = "coll.Index"
	FuncName_coll_Ints                   = "coll.Ints"
	FuncName_coll_Keys                   = "coll.Keys"
	FuncName_coll_List                   = "coll.List"
	FuncName_coll_MapAnyAny              = "coll.MapAnyAny"
	FuncName_coll_MapStringAny           = "coll.MapStringAny"
	FuncName_coll_Merge                  = "coll.Merge"
	FuncName_coll_Omit                   = "coll.Omit"
	FuncName_coll_Pick                   = "coll.Pick"
	FuncName_coll_Prepend                = "coll.Prepend"
	FuncName_coll_Push                   = "coll.Push"
	FuncName_coll_Reverse                = "coll.Reverse"
	FuncName_coll_Slice                  = "coll.Slice"
	FuncName_coll_Sort                   = "coll.Sort"
	FuncName_coll_Strings                = "coll.Strings"
	FuncName_coll_Uints                  = "coll.Uints"
	FuncName_coll_Unique                 = "coll.Unique"
	FuncName_coll_Values                 = "coll.Values"
	FuncName_contains                    = "contains"
	FuncName_cred                        = "cred"
	FuncName_cred_Htpasswd               = "cred.Htpasswd"
	FuncName_cred_Totp                   = "cred.Totp"
	FuncName_default                     = "default"
	FuncName_dict                        = "dict"
	FuncName_div                         = "div"
	FuncName_dns                         = "dns"
	FuncName_dns_CNAME                   = "dns.CNAME"
	FuncName_dns_HOST                    = "dns.HOST"
	FuncName_dns_IP                      = "dns.IP"
	FuncName_dns_SRV                     = "dns.SRV"
	FuncName_dns_TXT                     = "dns.TXT"
	FuncName_double                      = "double"
	FuncName_dup                         = "dup"
	FuncName_enc                         = "enc"
	FuncName_enc_Base32                  = "enc.Base32"
	FuncName_enc_Base64                  = "enc.Base64"
	FuncName_enc_Hex                     = "enc.Hex"
	FuncName_enc_JSON                    = "enc.JSON"
	FuncName_enc_YAML                    = "enc.YAML"
	FuncName_eq                          = "eq"
	FuncName_ge                          = "ge"
	FuncName_gt                          = "gt"
	FuncName_half                        = "half"
	FuncName_has                         = "has"
	FuncName_hasAny                      = "hasAny"
	FuncName_hasPrefix                   = "hasPrefix"
	FuncName_hasSuffix                   = "hasSuffix"
	FuncName_hash                        = "hash"
	FuncName_hash_ADLER32                = "hash.ADLER32"
	FuncName_hash_Bcrypt                 = "hash.Bcrypt"
	FuncName_hash_CRC32                  = "hash.CRC32"
	FuncName_hash_CRC64                  = "hash.CRC64"
	FuncName_hash_MD4                    = "hash.MD4"
	FuncName_hash_MD5                    = "hash.MD5"
	FuncName_hash_RIPEMD160              = "hash.RIPEMD160"
	FuncName_hash_SHA1                   = "hash.SHA1"
	FuncName_hash_SHA224                 = "hash.SHA224"
	FuncName_hash_SHA256                 = "hash.SHA256"
	FuncName_hash_SHA384                 = "hash.SHA384"
	FuncName_hash_SHA512                 = "hash.SHA512"
	FuncName_hash_SHA512_224             = "hash.SHA512_224"
	FuncName_hash_SHA512_256             = "hash.SHA512_256"
	FuncName_hex                         = "hex"
	FuncName_html                        = "html"
	FuncName_indent                      = "indent"
	FuncName_index                       = "index"
	FuncName_js                          = "js"
	FuncName_le                          = "le"
	FuncName_len                         = "len"
	FuncName_list                        = "list"
	FuncName_lower                       = "lower"
	FuncName_lt                          = "lt"
	FuncName_math                        = "math"
	FuncName_math_Abs                    = "math.Abs"
	FuncName_math_Add                    = "math.Add"
	FuncName_math_Add1                   = "math.Add1"
	FuncName_math_Ceil                   = "math.Ceil"
	FuncName_math_Div                    = "math.Div"
	FuncName_math_Double                 = "math.Double"
	FuncName_math_Floor                  = "math.Floor"
	FuncName_math_Half                   = "math.Half"
	FuncName_math_Log10                  = "math.Log10"
	FuncName_math_Log2                   = "math.Log2"
	FuncName_math_LogE                   = "math.LogE"
	FuncName_math_Max                    = "math.Max"
	FuncName_math_Min                    = "math.Min"
	FuncName_math_Mod                    = "math.Mod"
	FuncName_math_Mul                    = "math.Mul"
	FuncName_math_Pow                    = "math.Pow"
	FuncName_math_Round                  = "math.Round"
	FuncName_math_Seq                    = "math.Seq"
	FuncName_math_Sub                    = "math.Sub"
	FuncName_math_Sub1                   = "math.Sub1"
	FuncName_max                         = "max"
	FuncName_md5                         = "md5"
	FuncName_min                         = "min"
	FuncName_mod                         = "mod"
	FuncName_mul                         = "mul"
	FuncName_ne                          = "ne"
	FuncName_nindent                     = "nindent"
	FuncName_not                         = "not"
	FuncName_now                         = "now"
	FuncName_omit                        = "omit"
	FuncName_or                          = "or"
	FuncName_path                        = "path"
	FuncName_path_Base                   = "path.Base"
	FuncName_path_Clean                  = "path.Clean"
	FuncName_path_Dir                    = "path.Dir"
	FuncName_path_Ext                    = "path.Ext"
	FuncName_path_IsAbs                  = "path.IsAbs"
	FuncName_path_Join                   = "path.Join"
	FuncName_path_Match                  = "path.Match"
	FuncName_path_Split                  = "path.Split"
	FuncName_pick                        = "pick"
	FuncName_prepend                     = "prepend"
	FuncName_print                       = "print"
	FuncName_printf                      = "printf"
	FuncName_println                     = "println"
	FuncName_quote                       = "quote"
	FuncName_re                          = "re"
	FuncName_re_FindAll                  = "re.FindAll"
	FuncName_re_FindFirst                = "re.FindFirst"
	FuncName_re_FindN                    = "re.FindN"
	FuncName_re_Match                    = "re.Match"
	FuncName_re_QuoteMeta                = "re.QuoteMeta"
	FuncName_re_ReplaceAll               = "re.ReplaceAll"
	FuncName_re_ReplaceAllNoExpand       = "re.ReplaceAllNoExpand"
	FuncName_re_ReplaceFirst             = "re.ReplaceFirst"
	FuncName_re_ReplaceFirstNoExpand     = "re.ReplaceFirstNoExpand"
	FuncName_re_Split                    = "re.Split"
	FuncName_removePrefix                = "removePrefix"
	FuncName_removeSuffix                = "removeSuffix"
	FuncName_replaceAll                  = "replaceAll"
	FuncName_seq                         = "seq"
	FuncName_sha1                        = "sha1"
	FuncName_sha256                      = "sha256"
	FuncName_sha512                      = "sha512"
	FuncName_slice                       = "slice"
	FuncName_sockaddr                    = "sockaddr"
	FuncName_sockaddr_AllInterfaces      = "sockaddr.AllInterfaces"
	FuncName_sockaddr_Attr               = "sockaddr.Attr"
	FuncName_sockaddr_DefaultInterfaces  = "sockaddr.DefaultInterfaces"
	FuncName_sockaddr_Exclude            = "sockaddr.Exclude"
	FuncName_sockaddr_Include            = "sockaddr.Include"
	FuncName_sockaddr_InterfaceIP        = "sockaddr.InterfaceIP"
	FuncName_sockaddr_Join               = "sockaddr.Join"
	FuncName_sockaddr_Limit              = "sockaddr.Limit"
	FuncName_sockaddr_Math               = "sockaddr.Math"
	FuncName_sockaddr_Offset             = "sockaddr.Offset"
	FuncName_sockaddr_PrivateIP          = "sockaddr.PrivateIP"
	FuncName_sockaddr_PrivateInterfaces  = "sockaddr.PrivateInterfaces"
	FuncName_sockaddr_PublicIP           = "sockaddr.PublicIP"
	FuncName_sockaddr_PublicInterfaces   = "sockaddr.PublicInterfaces"
	FuncName_sockaddr_Sort               = "sockaddr.Sort"
	FuncName_sockaddr_Unique             = "sockaddr.Unique"
	FuncName_sort                        = "sort"
	FuncName_split                       = "split"
	FuncName_splitN                      = "splitN"
	FuncName_squote                      = "squote"
	FuncName_stringList                  = "stringList"
	FuncName_strings                     = "strings"
	FuncName_strings_Abbrev              = "strings.Abbrev"
	FuncName_strings_AddPrefix           = "strings.AddPrefix"
	FuncName_strings_AddSuffix           = "strings.AddSuffix"
	FuncName_strings_CamelCase           = "strings.CamelCase"
	FuncName_strings_Contains            = "strings.Contains"
	FuncName_strings_ContainsAny         = "strings.ContainsAny"
	FuncName_strings_DoubleQuote         = "strings.DoubleQuote"
	FuncName_strings_HasPrefix           = "strings.HasPrefix"
	FuncName_strings_HasSuffix           = "strings.HasSuffix"
	FuncName_strings_Indent              = "strings.Indent"
	FuncName_strings_Initials            = "strings.Initials"
	FuncName_strings_Join                = "strings.Join"
	FuncName_strings_KebabCase           = "strings.KebabCase"
	FuncName_strings_Lower               = "strings.Lower"
	FuncName_strings_NIndent             = "strings.NIndent"
	FuncName_strings_NoSpace             = "strings.NoSpace"
	FuncName_strings_RemovePrefix        = "strings.RemovePrefix"
	FuncName_strings_RemoveSuffix        = "strings.RemoveSuffix"
	FuncName_strings_Repeat              = "strings.Repeat"
	FuncName_strings_ReplaceAll          = "strings.ReplaceAll"
	FuncName_strings_RuneCount           = "strings.RuneCount"
	FuncName_strings_ShellQuote          = "strings.ShellQuote"
	FuncName_strings_Shuffle             = "strings.Shuffle"
	FuncName_strings_SingleQuote         = "strings.SingleQuote"
	FuncName_strings_Slug                = "strings.Slug"
	FuncName_strings_SnakeCase           = "strings.SnakeCase"
	FuncName_strings_Split               = "strings.Split"
	FuncName_strings_SplitN              = "strings.SplitN"
	FuncName_strings_Substr              = "strings.Substr"
	FuncName_strings_SwapCase            = "strings.SwapCase"
	FuncName_strings_Title               = "strings.Title"
	FuncName_strings_Trim                = "strings.Trim"
	FuncName_strings_TrimLeft            = "strings.TrimLeft"
	FuncName_strings_TrimPrefix          = "strings.TrimPrefix"
	FuncName_strings_TrimRight           = "strings.TrimRight"
	FuncName_strings_TrimSpace           = "strings.TrimSpace"
	FuncName_strings_TrimSuffix          = "strings.TrimSuffix"
	FuncName_strings_Unquote             = "strings.Unquote"
	FuncName_strings_Untitle             = "strings.Untitle"
	FuncName_strings_Upper               = "strings.Upper"
	FuncName_strings_WordWrap            = "strings.WordWrap"
	FuncName_sub                         = "sub"
	FuncName_sub1                        = "sub1"
	FuncName_time                        = "time"
	FuncName_time_Add                    = "time.Add"
	FuncName_time_Ceil                   = "time.Ceil"
	FuncName_time_CeilDuration           = "time.CeilDuration"
	FuncName_time_Day                    = "time.Day"
	FuncName_time_FMT_ANSI               = "time.FMT_ANSI"
	FuncName_time_FMT_Clock              = "time.FMT_Clock"
	FuncName_time_FMT_Date               = "time.FMT_Date"
	FuncName_time_FMT_DateTime           = "time.FMT_DateTime"
	FuncName_time_FMT_RFC3339            = "time.FMT_RFC3339"
	FuncName_time_FMT_RFC3339Nano        = "time.FMT_RFC3339Nano"
	FuncName_time_FMT_Ruby               = "time.FMT_Ruby"
	FuncName_time_FMT_Stamp              = "time.FMT_Stamp"
	FuncName_time_FMT_Unix               = "time.FMT_Unix"
	FuncName_time_Floor                  = "time.Floor"
	FuncName_time_FloorDuration          = "time.FloorDuration"
	FuncName_time_Format                 = "time.Format"
	FuncName_time_Hour                   = "time.Hour"
	FuncName_time_Microsecond            = "time.Microsecond"
	FuncName_time_Millisecond            = "time.Millisecond"
	FuncName_time_Minute                 = "time.Minute"
	FuncName_time_Nanosecond             = "time.Nanosecond"
	FuncName_time_Now                    = "time.Now"
	FuncName_time_Parse                  = "time.Parse"
	FuncName_time_ParseDuration          = "time.ParseDuration"
	FuncName_time_Round                  = "time.Round"
	FuncName_time_RoundDuration          = "time.RoundDuration"
	FuncName_time_Second                 = "time.Second"
	FuncName_time_Since                  = "time.Since"
	FuncName_time_Until                  = "time.Until"
	FuncName_time_Week                   = "time.Week"
	FuncName_time_ZoneName               = "time.ZoneName"
	FuncName_time_ZoneOffset             = "time.ZoneOffset"
	FuncName_title                       = "title"
	FuncName_toJson                      = "toJson"
	FuncName_toString                    = "toString"
	FuncName_toYaml                      = "toYaml"
	FuncName_totp                        = "totp"
	FuncName_trim                        = "trim"
	FuncName_trimPrefix                  = "trimPrefix"
	FuncName_trimSpace                   = "trimSpace"
	FuncName_trimSuffix                  = "trimSuffix"
	FuncName_type                        = "type"
	FuncName_type_AllTrue                = "type.AllTrue"
	FuncName_type_AnyTrue                = "type.AnyTrue"
	FuncName_type_Close                  = "type.Close"
	FuncName_type_Default                = "type.Default"
	FuncName_type_FirstNoneZero          = "type.FirstNoneZero"
	FuncName_type_IsBool                 = "type.IsBool"
	FuncName_type_IsFloat                = "type.IsFloat"
	FuncName_type_IsInt                  = "type.IsInt"
	FuncName_type_IsNum                  = "type.IsNum"
	FuncName_type_IsZero                 = "type.IsZero"
	FuncName_type_ToBool                 = "type.ToBool"
	FuncName_type_ToFloat                = "type.ToFloat"
	FuncName_type_ToInt                  = "type.ToInt"
	FuncName_type_ToString               = "type.ToString"
	FuncName_type_ToStrings              = "type.ToStrings"
	FuncName_type_ToUint                 = "type.ToUint"
	FuncName_uniq                        = "uniq"
	FuncName_upper                       = "upper"
	FuncName_urlquery                    = "urlquery"
	FuncName_uuid                        = "uuid"
	FuncName_uuid_IsValid                = "uuid.IsValid"
	FuncName_uuid_New                    = "uuid.New"
	FuncName_uuid_V1                     = "uuid.V1"
	FuncName_uuid_V4                     = "uuid.V4"
	FuncName_uuid_Zero                   = "uuid.Zero"

	// start of contextual funcs
	FuncName_VALUE                = "VALUE"
	FuncName_dukkha               = "dukkha"
	FuncName_dukkha_CacheDir      = "dukkha.CacheDir"
	FuncName_dukkha_CrossPlatform = "dukkha.CrossPlatform"
	FuncName_dukkha_FromJson      = "dukkha.FromJson"
	FuncName_dukkha_FromYaml      = "dukkha.FromYaml"
	FuncName_dukkha_JQ            = "dukkha.JQ"
	FuncName_dukkha_JQObj         = "dukkha.JQObj"
	FuncName_dukkha_Self          = "dukkha.Self"
	FuncName_dukkha_Set           = "dukkha.Set"
	FuncName_dukkha_SetValue      = "dukkha.SetValue"
	FuncName_dukkha_WorkDir       = "dukkha.WorkDir"
	FuncName_dukkha_YQ            = "dukkha.YQ"
	FuncName_dukkha_YQObj         = "dukkha.YQObj"
	FuncName_env                  = "env"
	FuncName_eval                 = "eval"
	FuncName_eval_Env             = "eval.Env"
	FuncName_eval_Shell           = "eval.Shell"
	FuncName_eval_Template        = "eval.Template"
	FuncName_find                 = "find"
	FuncName_fromJson             = "fromJson"
	FuncName_fromYaml             = "fromYaml"
	FuncName_fs                   = "fs"
	FuncName_fs_Abs               = "fs.Abs"
	FuncName_fs_AppendFile        = "fs.AppendFile"
	FuncName_fs_Base              = "fs.Base"
	FuncName_fs_Clean             = "fs.Clean"
	FuncName_fs_Dir               = "fs.Dir"
	FuncName_fs_Exists            = "fs.Exists"
	FuncName_fs_Ext               = "fs.Ext"
	FuncName_fs_Find              = "fs.Find"
	FuncName_fs_FromSlash         = "fs.FromSlash"
	FuncName_fs_Glob              = "fs.Glob"
	FuncName_fs_IsAbs             = "fs.IsAbs"
	FuncName_fs_IsCharDevice      = "fs.IsCharDevice"
	FuncName_fs_IsDevice          = "fs.IsDevice"
	FuncName_fs_IsDir             = "fs.IsDir"
	FuncName_fs_IsFIFO            = "fs.IsFIFO"
	FuncName_fs_IsOther           = "fs.IsOther"
	FuncName_fs_IsSocket          = "fs.IsSocket"
	FuncName_fs_IsSymlink         = "fs.IsSymlink"
	FuncName_fs_Join              = "fs.Join"
	FuncName_fs_Lookup            = "fs.Lookup"
	FuncName_fs_LookupFile        = "fs.LookupFile"
	FuncName_fs_Match             = "fs.Match"
	FuncName_fs_Mkdir             = "fs.Mkdir"
	FuncName_fs_OpenFile          = "fs.OpenFile"
	FuncName_fs_ReadDir           = "fs.ReadDir"
	FuncName_fs_ReadFile          = "fs.ReadFile"
	FuncName_fs_Rel               = "fs.Rel"
	FuncName_fs_Split             = "fs.Split"
	FuncName_fs_ToSlash           = "fs.ToSlash"
	FuncName_fs_Touch             = "fs.Touch"
	FuncName_fs_UserCacheDir      = "fs.UserCacheDir"
	FuncName_fs_UserConfigDir     = "fs.UserConfigDir"
	FuncName_fs_UserHomeDir       = "fs.UserHomeDir"
	FuncName_fs_VolumeName        = "fs.VolumeName"
	FuncName_fs_WriteFile         = "fs.WriteFile"
	FuncName_git                  = "git"
	FuncName_host                 = "host"
	FuncName_jq                   = "jq"
	FuncName_jqObj                = "jqObj"
	FuncName_matrix               = "matrix"
	FuncName_mkdir                = "mkdir"
	FuncName_os                   = "os"
	FuncName_os_Stderr            = "os.Stderr"
	FuncName_os_Stdin             = "os.Stdin"
	FuncName_os_Stdout            = "os.Stdout"
	FuncName_state                = "state"
	FuncName_state_Failed         = "state.Failed"
	FuncName_state_Succeeded      = "state.Succeeded"
	FuncName_tag                  = "tag"
	FuncName_tag_ImageName        = "tag.ImageName"
	FuncName_tag_ImageTag         = "tag.ImageTag"
	FuncName_tag_ManifestName     = "tag.ManifestName"
	FuncName_tag_ManifestTag      = "tag.ManifestTag"
	FuncName_touch                = "touch"
	FuncName_values               = "values"
	FuncName_write                = "write"
	FuncName_yq                   = "yq"
	FuncName_yqObj                = "yqObj"

	// start of placeholder funcs
	FuncName_include = "include"
	FuncName_var     = "var"


This section is empty.


func AddPrefix

func AddPrefix(s, prefix, sep string) string

AddPrefix to each separated string elements

func AddSuffix

func AddSuffix(s, suffix, sep string) string

AddSuffix to each separated string elements

func CreateShellRunner added in v0.8.0

func CreateShellRunner(
	workdir string,
	rc dukkha.RenderingContext,
	stdin io.Reader,
	stdout, stderr io.Writer,
) (*interp.Runner, error)

func CreateTemplate

func CreateTemplate(rc dukkha.RenderingContext) *template.Template

func ExecCmdAsTemplateFuncCall

func ExecCmdAsTemplateFuncCall(
	rc dukkha.RenderingContext,
	pipeStdin io.Reader,
	pipeStdout io.Writer,
	args []string,
) (stdout, stderr string, err error)

ExecCmdAsTemplateFuncCall executes cmd as a template func args[0] should be a template func name, see funcs.go for reference

func ExpandEnv added in v0.4.3

func ExpandEnv(rc dukkha.RenderingContext, toExpand string, enableExec bool) (string, error)

ExpandEnv expands unix style environment variable (`$FOO`, `${BAR}`) if enableExec is set to ture, also supports arbitrary command execution using `$(do something)`

func FromText added in v0.8.0

func FromText(
	rc dukkha.RenderingContext,
	v Bytes,
	newDecoder func(io.Reader) DataDecoder,
	unmarshal func(data []byte, out any) error,
) (_ any, err error)

TODO: support optional resolving

func GenerateTOTPCode added in v0.4.0

func GenerateTOTPCode(token string, t time.Time, codeLength int) (string, error)

MIT License

Copyright (c)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.


Copied from https://github.com/yitsushi/totp-cli/blob/main/internal/security/otp.go with modification to codeLength

func GetDefaultTag added in v0.2.0

func GetDefaultTag(
	rc dukkha.RenderingContext,
	name string,
	isManifest bool,
	keepKernelInfo bool,
) string

func GetFullImageName_UseDefault_IfIfNoTagSet added in v0.8.0

func GetFullImageName_UseDefault_IfIfNoTagSet(
	rc dukkha.RenderingContext, imageName string, keepKernelInfo bool,
) string

func GetFullManifestName_UseDefault_IfNoTagSet added in v0.8.0

func GetFullManifestName_UseDefault_IfNoTagSet(
	rc dukkha.RenderingContext, manifestName string,
) string

func GetImageTag added in v0.8.0

func GetImageTag(
	rc dukkha.RenderingContext, imageName string, keepKernelInfo bool,
) string

func GetManifestTag added in v0.8.0

func GetManifestTag(
	rc dukkha.RenderingContext, manifestName string,
) string

func HTMLEscape added in v0.8.0

func HTMLEscape(w io.Writer, b []byte)

HTMLEscape writes to w the escaped HTML equivalent of the plain text data b.

func IsZero added in v0.8.0

func IsZero(v any) bool


func JQ added in v0.8.0

func JQ(
	rc dukkha.RenderingContext,
	v Bytes,
	opts JQOptions,
) error

JQ evaluates jq expression over v

func ModDuration added in v0.8.0

func ModDuration(d, x time.Duration, action modAction) time.Duration

ModDuration return a new duration of x that is multiple of d

func ModTime added in v0.8.0

func ModTime(d time.Duration, t time.Time, action modAction) (ret time.Time)

ModTime returns a new value base on t in timezone of the time t

time.{Round, Truncat} operates on UTC time

e.g. 01:01:31 in TZ -11:30 (12:31:31 in UTC)

timezone offset = -11:30

thus will have default behavior when dur is 1hr

time.Round(12:31:31): 13:00:00 UTC -> 01:30:00 in TZ -11:30 time.Truncat(12:31:31): 12:00:00 UTC -> 00:30:00 in TZ -11:30

what actually expected to local time is

floor: 01:00:00 round: 01:00:00 ceil: 02:00:00

func RegexpReplaceExpandN added in v0.9.0

func RegexpReplaceExpandN(re *regexp.Regexp, src, repl []byte, n int) []byte

func RegexpReplaceN added in v0.9.0

func RegexpReplaceN(re *regexp.Regexp, src []byte, n int, repl func(dest []byte, match []int) []byte) (buf []byte)

func RegexpReplaceNoExpandN added in v0.9.0

func RegexpReplaceNoExpandN(re *regexp.Regexp, src, repl []byte, n int) []byte

func RegisterTemplateFuncs

func RegisterTemplateFuncs(fm map[string]TemplateFuncFactory)

func RemoveMatchedRunesCopy added in v0.8.0

func RemoveMatchedRunesCopy(str string, match func(r rune) bool) string

func RemoveMatchedRunesInPlace added in v0.8.0

func RemoveMatchedRunesInPlace(p []byte, match func(r rune) bool) (n int)

RemoveMatchedRunesInPlace removes all matched runes in p, return new size of p, which is always <= len(p)

func RemovePrefix

func RemovePrefix(s, prefix, sep string) string

RemovePrefix of each separated string elements

func RemoveSuffix

func RemoveSuffix(s, suffix, sep string) string

func ReplaceMatchedRunesCopy added in v0.8.0

func ReplaceMatchedRunesCopy(
	str string,
	match func(r rune) bool,
	replace func(matched string) string,
) string

func RunScript added in v0.8.0

func RunScript(
	ctx context.Context,
	runner *interp.Runner,
	parser *syntax.Parser,
	script string,
) error

func WordWrap added in v0.8.0

func WordWrap(in string, opts WordWrapOpts) string

WordWrap - insert line-breaks into the string, before it reaches the given width.


type Bool added in v0.8.0

type Bool any

Bool type is applicable to - ~string (convert "true", "yes", "y", "1" to true, "false", "no", "n", "0", "" to false) - ~[]~byte (like string) - integers (true if non-zero) - floats (true if non-zero) - bool value

type Bytes added in v0.8.0

type Bytes any

Bytes type applicable to - ~string - ~[]~byte - integers/floats (formated as decimal string bytes) - bool value (converted to bytes of "true" or "false") - io.Reader - fmt.Stringer

type ChunkedWriter added in v0.8.0

type ChunkedWriter struct {
	// contains filtered or unexported fields

func NewChunkedWriter added in v0.8.0

func NewChunkedWriter(
	chunkSize int,
	underlay io.Writer,
	doBeforeEachChunkWriting func() error,
	doAfterEachChunkWrote func() error,
) ChunkedWriter

func (*ChunkedWriter) Remainder added in v0.8.0

func (cw *ChunkedWriter) Remainder() int

func (*ChunkedWriter) Write added in v0.8.0

func (cw *ChunkedWriter) Write(p []byte) (wrote int, err error)

type DataDecoder added in v0.8.0

type DataDecoder interface {
	Decode(any) error

type Duration added in v0.8.0

type Duration any

Duration type applicable to - ~string (parsed using time.ParseDuration) - ~[]~byte (parsed using time.ParseDuration) - integers (as nanoseconds) - floats (as seconds)

type FilterReader added in v0.8.0

type FilterReader struct {
	// contains filtered or unexported fields

func NewFilterReader added in v0.8.0

func NewFilterReader(
	underlay io.Reader,
	doFilter func(p []byte) int,
) FilterReader

func (FilterReader) Read added in v0.8.0

func (fr FilterReader) Read(p []byte) (n int, err error)

type FuncID added in v0.8.0

type FuncID int32
const (

	// start of static funcs
	FuncID_add                         FuncID // func(...Number) (Number, error)
	FuncID_add1                               // func(Number) (Number, error)
	FuncID_addPrefix                          // func(...String) (string, error)
	FuncID_addSuffix                          // func(...String) (string, error)
	FuncID_all                                // func(...any) bool
	FuncID_and                                // func(any, ...any) any
	FuncID_any                                // func(...any) bool
	FuncID_append                             // func(...any) (any, error)
	FuncID_archconv                           // func() archconvNS
	FuncID_archconv_AlpineArch                // func(String) string
	FuncID_archconv_AlpineTripleName          // func(String) string
	FuncID_archconv_DebianArch                // func(String) string
	FuncID_archconv_DebianTripleName          // func(String, ...String) string
	FuncID_archconv_DockerArch                // func(String) string
	FuncID_archconv_DockerArchVariant         // func(String) string
	FuncID_archconv_DockerHubArch             // func(String, ...String) string
	FuncID_archconv_DockerOS                  // func(String) string
	FuncID_archconv_DockerPlatformArch        // func(String) string
	FuncID_archconv_GNUArch                   // func(String) string
	FuncID_archconv_GNUTripleName             // func(String, ...String) string
	FuncID_archconv_GolangArch                // func(String) string
	FuncID_archconv_GolangOS                  // func(String) string
	FuncID_archconv_HF                        // func(String) string
	FuncID_archconv_HardFloatArch             // func(String) string
	FuncID_archconv_LLVMArch                  // func(String) string
	FuncID_archconv_LLVMTripleName            // func(String, ...String) string
	FuncID_archconv_OciArch                   // func(String) string
	FuncID_archconv_OciArchVariant            // func(String) string
	FuncID_archconv_OciOS                     // func(String) string
	FuncID_archconv_QemuArch                  // func(String) string
	FuncID_archconv_SF                        // func(String) string
	FuncID_archconv_SimpleArch                // func(String) string
	FuncID_archconv_SoftFloatArch             // func(String) string
	FuncID_base64                             // func(...any) (string, error)
	FuncID_call                               // func(any, ...any) (any, error)
	FuncID_close                              // func(any) (None, error)
	FuncID_coll                               // func() collNS
	FuncID_coll_Append                        // func(...any) (any, error)
	FuncID_coll_Bools                         // func(...Bool) ([]bool, error)
	FuncID_coll_Dup                           // func(any) (any, error)
	FuncID_coll_Flatten                       // func(...any) ([]any, error)
	FuncID_coll_Floats                        // func(...Number) ([]float64, error)
	FuncID_coll_HasAll                        // func(...any) (bool, error)
	FuncID_coll_HasAny                        // func(...any) (bool, error)
	FuncID_coll_Index                         // func(any, any) (any, error)
	FuncID_coll_Ints                          // func(...Number) ([]int64, error)
	FuncID_coll_Keys                          // func(Map) ([]string, error)
	FuncID_coll_List                          // func(...any) []any
	FuncID_coll_MapAnyAny                     // func(...any) map[any]any
	FuncID_coll_MapStringAny                  // func(...any) (map[string]any, error)
	FuncID_coll_Merge                         // func(...Map) (Map, error)
	FuncID_coll_Omit                          // func(...any) (any, error)
	FuncID_coll_Pick                          // func(...any) (any, error)
	FuncID_coll_Prepend                       // func(...any) (any, error)
	FuncID_coll_Push                          // func(...any) (any, error)
	FuncID_coll_Reverse                       // func(any) (any, error)
	FuncID_coll_Slice                         // func(...any) (Slice, error)
	FuncID_coll_Sort                          // func(Slice) (Slice, error)
	FuncID_coll_Strings                       // func(...String) ([]string, error)
	FuncID_coll_Uints                         // func(...Number) ([]uint64, error)
	FuncID_coll_Unique                        // func(Slice) (any, error)
	FuncID_coll_Values                        // func(Map) ([]any, error)
	FuncID_contains                           // func(String, String) (bool, error)
	FuncID_cred                               // func() credentialNS
	FuncID_cred_Htpasswd                      // func(String, String) (string, error)
	FuncID_cred_Totp                          // func(...any) (string, error)
	FuncID_default                            // func(any, any) any
	FuncID_dict                               // func(...any) (map[string]any, error)
	FuncID_div                                // func(...Number) (Number, error)
	FuncID_dns                                // func() dnsNS
	FuncID_dns_CNAME                          // func(...String) (string, error)
	FuncID_dns_HOST                           // func(...String) ([]string, error)
	FuncID_dns_IP                             // func(...String) ([]string, error)
	FuncID_dns_SRV                            // func(...String) ([]*net.SRV, error)
	FuncID_dns_TXT                            // func(...String) ([]string, error)
	FuncID_double                             // func(Number) (Number, error)
	FuncID_dup                                // func(any) (any, error)
	FuncID_enc                                // func() encNS
	FuncID_enc_Base32                         // func(...any) (string, error)
	FuncID_enc_Base64                         // func(...any) (string, error)
	FuncID_enc_Hex                            // func(...any) (string, error)
	FuncID_enc_JSON                           // func(...any) (string, error)
	FuncID_enc_YAML                           // func(...any) (string, error)
	FuncID_eq                                 // func(any, ...any) (bool, error)
	FuncID_ge                                 // func(any, any) (bool, error)
	FuncID_gt                                 // func(any, any) (bool, error)
	FuncID_half                               // func(Number) (Number, error)
	FuncID_has                                // func(...any) (bool, error)
	FuncID_hasAny                             // func(...any) (bool, error)
	FuncID_hasPrefix                          // func(String, String) (bool, error)
	FuncID_hasSuffix                          // func(String, String) (bool, error)
	FuncID_hash                               // func() hashNS
	FuncID_hash_ADLER32                       // func(...any) (string, error)
	FuncID_hash_Bcrypt                        // func(...any) (string, error)
	FuncID_hash_CRC32                         // func(...any) (string, error)
	FuncID_hash_CRC64                         // func(...any) (string, error)
	FuncID_hash_MD4                           // func(...any) (string, error)
	FuncID_hash_MD5                           // func(...any) (string, error)
	FuncID_hash_RIPEMD160                     // func(...any) (string, error)
	FuncID_hash_SHA1                          // func(...any) (string, error)
	FuncID_hash_SHA224                        // func(...any) (string, error)
	FuncID_hash_SHA256                        // func(...any) (string, error)
	FuncID_hash_SHA384                        // func(...any) (string, error)
	FuncID_hash_SHA512                        // func(...any) (string, error)
	FuncID_hash_SHA512_224                    // func(...any) (string, error)
	FuncID_hash_SHA512_256                    // func(...any) (string, error)
	FuncID_hex                                // func(...any) (string, error)
	FuncID_html                               // func(...any) string
	FuncID_indent                             // func(...any) (string, error)
	FuncID_index                              // func(any, any) (any, error)
	FuncID_js                                 // func(...any) string
	FuncID_le                                 // func(any, any) (bool, error)
	FuncID_len                                // func(any) (int, error)
	FuncID_list                               // func(...any) []any
	FuncID_lower                              // func(String) (string, error)
	FuncID_lt                                 // func(any, any) (bool, error)
	FuncID_math                               // func() mathNS
	FuncID_math_Abs                           // func(Number) (Number, error)
	FuncID_math_Add                           // func(...Number) (Number, error)
	FuncID_math_Add1                          // func(Number) (Number, error)
	FuncID_math_Ceil                          // func(Number) (float64, error)
	FuncID_math_Div                           // func(...Number) (Number, error)
	FuncID_math_Double                        // func(Number) (Number, error)
	FuncID_math_Floor                         // func(Number) (float64, error)
	FuncID_math_Half                          // func(Number) (Number, error)
	FuncID_math_Log10                         // func(Number) (float64, error)
	FuncID_math_Log2                          // func(Number) (float64, error)
	FuncID_math_LogE                          // func(Number) (float64, error)
	FuncID_math_Max                           // func(...Number) (any, error)
	FuncID_math_Min                           // func(...Number) (any, error)
	FuncID_math_Mod                           // func(...Number) (Number, error)
	FuncID_math_Mul                           // func(...Number) (Number, error)
	FuncID_math_Pow                           // func(...Number) (Number, error)
	FuncID_math_Round                         // func(Number) (float64, error)
	FuncID_math_Seq                           // func(...Number) ([]int64, error)
	FuncID_math_Sub                           // func(...Number) (Number, error)
	FuncID_math_Sub1                          // func(Number) (Number, error)
	FuncID_max                                // func(...Number) (any, error)
	FuncID_md5                                // func(...any) (string, error)
	FuncID_min                                // func(...Number) (any, error)
	FuncID_mod                                // func(...Number) (Number, error)
	FuncID_mul                                // func(...Number) (Number, error)
	FuncID_ne                                 // func(any, any) (bool, error)
	FuncID_nindent                            // func(...any) (string, error)
	FuncID_not                                // func(any) bool
	FuncID_now                                // func(...String) (time.Time, error)
	FuncID_omit                               // func(...any) (any, error)
	FuncID_or                                 // func(any, ...any) any
	FuncID_path                               // func() pathNS
	FuncID_path_Base                          // func(String) string
	FuncID_path_Clean                         // func(String) string
	FuncID_path_Dir                           // func(String) string
	FuncID_path_Ext                           // func(String) string
	FuncID_path_IsAbs                         // func(String) bool
	FuncID_path_Join                          // func(...String) (string, error)
	FuncID_path_Match                         // func(String, String) (bool, error)
	FuncID_path_Split                         // func(String) []string
	FuncID_pick                               // func(...any) (any, error)
	FuncID_prepend                            // func(...any) (any, error)
	FuncID_print                              // func(...any) string
	FuncID_printf                             // func(String, ...any) string
	FuncID_println                            // func(...any) string
	FuncID_quote                              // func(String) (string, error)
	FuncID_re                                 // func() regexpNS
	FuncID_re_FindAll                         // func(...String) ([]string, error)
	FuncID_re_FindFirst                       // func(...String) (string, error)
	FuncID_re_FindN                           // func(...String) ([]string, error)
	FuncID_re_Match                           // func(...String) (bool, error)
	FuncID_re_QuoteMeta                       // func(String) string
	FuncID_re_ReplaceAll                      // func(...String) (string, error)
	FuncID_re_ReplaceAllNoExpand              // func(...String) (string, error)
	FuncID_re_ReplaceFirst                    // func(...String) (string, error)
	FuncID_re_ReplaceFirstNoExpand            // func(...String) (string, error)
	FuncID_re_Split                           // func(...String) ([]string, error)
	FuncID_removePrefix                       // func(...String) (string, error)
	FuncID_removeSuffix                       // func(...String) (string, error)
	FuncID_replaceAll                         // func(String, String, String) (string, error)
	FuncID_seq                                // func(...Number) ([]int64, error)
	FuncID_sha1                               // func(...any) (string, error)
	FuncID_sha256                             // func(...any) (string, error)
	FuncID_sha512                             // func(...any) (string, error)
	FuncID_slice                              // func(...any) (Slice, error)
	FuncID_sockaddr                           // func() sockaddrNS
	FuncID_sockaddr_AllInterfaces             // func() (sockaddr.IfAddrs, error)
	FuncID_sockaddr_Attr                      // func(String, any) (string, error)
	FuncID_sockaddr_DefaultInterfaces         // func() (sockaddr.IfAddrs, error)
	FuncID_sockaddr_Exclude                   // func(String, String, sockaddr.IfAddrs) (sockaddr.IfAddrs, error)
	FuncID_sockaddr_Include                   // func(String, String, sockaddr.IfAddrs) (sockaddr.IfAddrs, error)
	FuncID_sockaddr_InterfaceIP               // func(String) (string, error)
	FuncID_sockaddr_Join                      // func(String, String, sockaddr.IfAddrs) (string, error)
	FuncID_sockaddr_Limit                     // func(Number, sockaddr.IfAddrs) (sockaddr.IfAddrs, error)
	FuncID_sockaddr_Math                      // func(String, String, sockaddr.IfAddrs) (sockaddr.IfAddrs, error)
	FuncID_sockaddr_Offset                    // func(Number, sockaddr.IfAddrs) (sockaddr.IfAddrs, error)
	FuncID_sockaddr_PrivateIP                 // func() (string, error)
	FuncID_sockaddr_PrivateInterfaces         // func() (sockaddr.IfAddrs, error)
	FuncID_sockaddr_PublicIP                  // func() (string, error)
	FuncID_sockaddr_PublicInterfaces          // func() (sockaddr.IfAddrs, error)
	FuncID_sockaddr_Sort                      // func(String, sockaddr.IfAddrs) (sockaddr.IfAddrs, error)
	FuncID_sockaddr_Unique                    // func(String, sockaddr.IfAddrs) (sockaddr.IfAddrs, error)
	FuncID_sort                               // func(Slice) (Slice, error)
	FuncID_split                              // func(String, String) ([]string, error)
	FuncID_splitN                             // func(String, Number, String) ([]string, error)
	FuncID_squote                             // func(String) (string, error)
	FuncID_stringList                         // func(...String) ([]string, error)
	FuncID_strings                            // func() stringsNS
	FuncID_strings_Abbrev                     // func(...any) (string, error)
	FuncID_strings_AddPrefix                  // func(...String) (string, error)
	FuncID_strings_AddSuffix                  // func(...String) (string, error)
	FuncID_strings_CamelCase                  // func(String) (string, error)
	FuncID_strings_Contains                   // func(String, String) (bool, error)
	FuncID_strings_ContainsAny                // func(String, String) (bool, error)
	FuncID_strings_DoubleQuote                // func(String) (string, error)
	FuncID_strings_HasPrefix                  // func(String, String) (bool, error)
	FuncID_strings_HasSuffix                  // func(String, String) (bool, error)
	FuncID_strings_Indent                     // func(...any) (string, error)
	FuncID_strings_Initials                   // func(String) (string, error)
	FuncID_strings_Join                       // func(any, any) (string, error)
	FuncID_strings_KebabCase                  // func(String) (string, error)
	FuncID_strings_Lower                      // func(String) (string, error)
	FuncID_strings_NIndent                    // func(...any) (string, error)
	FuncID_strings_NoSpace                    // func(String) (string, error)
	FuncID_strings_RemovePrefix               // func(...String) (string, error)
	FuncID_strings_RemoveSuffix               // func(...String) (string, error)
	FuncID_strings_Repeat                     // func(Number, String) (string, error)
	FuncID_strings_ReplaceAll                 // func(String, String, String) (string, error)
	FuncID_strings_RuneCount                  // func(...String) (int, error)
	FuncID_strings_ShellQuote                 // func(...String) (string, error)
	FuncID_strings_Shuffle                    // func(String) (string, error)
	FuncID_strings_SingleQuote                // func(String) (string, error)
	FuncID_strings_Slug                       // func(String) (string, error)
	FuncID_strings_SnakeCase                  // func(String) (string, error)
	FuncID_strings_Split                      // func(String, String) ([]string, error)
	FuncID_strings_SplitN                     // func(String, Number, String) ([]string, error)
	FuncID_strings_Substr                     // func(...any) (string, error)
	FuncID_strings_SwapCase                   // func(String) (string, error)
	FuncID_strings_Title                      // func(String) (string, error)
	FuncID_strings_Trim                       // func(String, String) (string, error)
	FuncID_strings_TrimLeft                   // func(String, String) (string, error)
	FuncID_strings_TrimPrefix                 // func(String, String) (string, error)
	FuncID_strings_TrimRight                  // func(String, String) (string, error)
	FuncID_strings_TrimSpace                  // func(String) (string, error)
	FuncID_strings_TrimSuffix                 // func(String, String) (string, error)
	FuncID_strings_Unquote                    // func(String) (string, error)
	FuncID_strings_Untitle                    // func(String) (string, error)
	FuncID_strings_Upper                      // func(String) (string, error)
	FuncID_strings_WordWrap                   // func(...any) (string, error)
	FuncID_sub                                // func(...Number) (Number, error)
	FuncID_sub1                               // func(Number) (Number, error)
	FuncID_time                               // func() timeNS
	FuncID_time_Add                           // func(Duration, Time) (time.Time, error)
	FuncID_time_Ceil                          // func(Duration, Time) (time.Time, error)
	FuncID_time_CeilDuration                  // func(Duration, Duration) (time.Duration, error)
	FuncID_time_Day                           // func(...Number) (time.Duration, error)
	FuncID_time_FMT_ANSI                      // func() string
	FuncID_time_FMT_Clock                     // func() string
	FuncID_time_FMT_Date                      // func() string
	FuncID_time_FMT_DateTime                  // func() string
	FuncID_time_FMT_RFC3339                   // func() string
	FuncID_time_FMT_RFC3339Nano               // func() string
	FuncID_time_FMT_Ruby                      // func() string
	FuncID_time_FMT_Stamp                     // func() string
	FuncID_time_FMT_Unix                      // func() string
	FuncID_time_Floor                         // func(Duration, Time) (time.Time, error)
	FuncID_time_FloorDuration                 // func(Duration, Duration) (time.Duration, error)
	FuncID_time_Format                        // func(...any) (string, error)
	FuncID_time_Hour                          // func(...Number) (time.Duration, error)
	FuncID_time_Microsecond                   // func(...Number) (time.Duration, error)
	FuncID_time_Millisecond                   // func(...Number) (time.Duration, error)
	FuncID_time_Minute                        // func(...Number) (time.Duration, error)
	FuncID_time_Nanosecond                    // func(...Number) (time.Duration, error)
	FuncID_time_Now                           // func(...String) (time.Time, error)
	FuncID_time_Parse                         // func(...any) (time.Time, error)
	FuncID_time_ParseDuration                 // func(String) (time.Duration, error)
	FuncID_time_Round                         // func(Duration, Time) (time.Time, error)
	FuncID_time_RoundDuration                 // func(Duration, Duration) (time.Duration, error)
	FuncID_time_Second                        // func(...Number) (time.Duration, error)
	FuncID_time_Since                         // func(...Time) (time.Duration, error)
	FuncID_time_Until                         // func(...Time) (time.Duration, error)
	FuncID_time_Week                          // func(...Number) (time.Duration, error)
	FuncID_time_ZoneName                      // func(...any) (string, error)
	FuncID_time_ZoneOffset                    // func(...any) (int, error)
	FuncID_title                              // func(String) (string, error)
	FuncID_toJson                             // func(...any) (string, error)
	FuncID_toString                           // func(any) (string, error)
	FuncID_toYaml                             // func(...any) (string, error)
	FuncID_totp                               // func(...any) (string, error)
	FuncID_trim                               // func(String, String) (string, error)
	FuncID_trimPrefix                         // func(String, String) (string, error)
	FuncID_trimSpace                          // func(String) (string, error)
	FuncID_trimSuffix                         // func(String, String) (string, error)
	FuncID_type                               // func() typeNS
	FuncID_type_AllTrue                       // func(...any) bool
	FuncID_type_AnyTrue                       // func(...any) bool
	FuncID_type_Close                         // func(any) (None, error)
	FuncID_type_Default                       // func(any, any) any
	FuncID_type_FirstNoneZero                 // func(...any) any
	FuncID_type_IsBool                        // func(any) bool
	FuncID_type_IsFloat                       // func(any) bool
	FuncID_type_IsInt                         // func(any) bool
	FuncID_type_IsNum                         // func(any) bool
	FuncID_type_IsZero                        // func(any) bool
	FuncID_type_ToBool                        // func(any) (bool, error)
	FuncID_type_ToFloat                       // func(any) (float64, error)
	FuncID_type_ToInt                         // func(any) (int64, error)
	FuncID_type_ToString                      // func(any) (string, error)
	FuncID_type_ToStrings                     // func(any) ([]string, error)
	FuncID_type_ToUint                        // func(any) (uint64, error)
	FuncID_uniq                               // func(Slice) (any, error)
	FuncID_upper                              // func(String) (string, error)
	FuncID_urlquery                           // func(...any) string
	FuncID_uuid                               // func() uuidNS
	FuncID_uuid_IsValid                       // func(String) bool
	FuncID_uuid_New                           // func(...Number) (string, error)
	FuncID_uuid_V1                            // func() (string, error)
	FuncID_uuid_V4                            // func() (string, error)
	FuncID_uuid_Zero                          // func() string

	// start of contextual funcs
	FuncID_VALUE                // func() any
	FuncID_dukkha               // func() dukkhaNS
	FuncID_dukkha_CacheDir      // func() string
	FuncID_dukkha_CrossPlatform // func(...String) bool
	FuncID_dukkha_FromJson      // func(Bytes) (any, error)
	FuncID_dukkha_FromYaml      // func(Bytes) (any, error)
	FuncID_dukkha_JQ            // func(...any) (string, error)
	FuncID_dukkha_JQObj         // func(...any) (any, error)
	FuncID_dukkha_Self          // func(...String) (struct { Stdout string; Stderr string }, error)
	FuncID_dukkha_Set           // func(String, any) (any, error)
	FuncID_dukkha_SetValue      // func(String, any) (any, error)
	FuncID_dukkha_WorkDir       // func() string
	FuncID_dukkha_YQ            // func(...any) (string, error)
	FuncID_dukkha_YQObj         // func(...any) (any, error)
	FuncID_env                  // func() map[string]tlang.LazyValueType[string]
	FuncID_eval                 // func() evalNS
	FuncID_eval_Env             // func(...String) (string, error)
	FuncID_eval_Shell           // func(String, ...Bytes) (struct { Stdout string; Stderr string }, error)
	FuncID_eval_Template        // func(String) (string, error)
	FuncID_find                 // func(String, ...String) ([]string, error)
	FuncID_fromJson             // func(Bytes) (any, error)
	FuncID_fromYaml             // func(Bytes) (any, error)
	FuncID_fs                   // func() fsNS
	FuncID_fs_Abs               // func(String) (string, error)
	FuncID_fs_AppendFile        // func(String, ...any) (None, error)
	FuncID_fs_Base              // func(String) string
	FuncID_fs_Clean             // func(String) string
	FuncID_fs_Dir               // func(String) string
	FuncID_fs_Exists            // func(String) (bool, error)
	FuncID_fs_Ext               // func(String) string
	FuncID_fs_Find              // func(String, ...String) ([]string, error)
	FuncID_fs_FromSlash         // func(String) string
	FuncID_fs_Glob              // func(String) ([]string, error)
	FuncID_fs_IsAbs             // func(String) bool
	FuncID_fs_IsCharDevice      // func(String) bool
	FuncID_fs_IsDevice          // func(String) bool
	FuncID_fs_IsDir             // func(String) bool
	FuncID_fs_IsFIFO            // func(String) bool
	FuncID_fs_IsOther           // func(String) bool
	FuncID_fs_IsSocket          // func(String) bool
	FuncID_fs_IsSymlink         // func(String) bool
	FuncID_fs_Join              // func(...String) (string, error)
	FuncID_fs_Lookup            // func(...String) (string, error)
	FuncID_fs_LookupFile        // func(...String) (string, error)
	FuncID_fs_Match             // func(String, String) (bool, error)
	FuncID_fs_Mkdir             // func(...String) (None, error)
	FuncID_fs_OpenFile          // func(...String) (*os.File, error)
	FuncID_fs_ReadDir           // func(String) ([]string, error)
	FuncID_fs_ReadFile          // func(String) (string, error)
	FuncID_fs_Rel               // func(String, String) (string, error)
	FuncID_fs_Split             // func(String) (string, string)
	FuncID_fs_ToSlash           // func(String) string
	FuncID_fs_Touch             // func(String) (None, error)
	FuncID_fs_UserCacheDir      // func() string
	FuncID_fs_UserConfigDir     // func() string
	FuncID_fs_UserHomeDir       // func() string
	FuncID_fs_VolumeName        // func(String) string
	FuncID_fs_WriteFile         // func(String, ...any) (None, error)
	FuncID_git                  // func() map[string]tlang.LazyValueType[string]
	FuncID_host                 // func() map[string]tlang.LazyValueType[string]
	FuncID_jq                   // func(...any) (string, error)
	FuncID_jqObj                // func(...any) (any, error)
	FuncID_matrix               // func() map[string]string
	FuncID_mkdir                // func(...String) (None, error)
	FuncID_os                   // func() osNS
	FuncID_os_Stderr            // func() io.Writer
	FuncID_os_Stdin             // func() io.Reader
	FuncID_os_Stdout            // func() io.Writer
	FuncID_state                // func() stateNS
	FuncID_state_Failed         // func() bool
	FuncID_state_Succeeded      // func() bool
	FuncID_tag                  // func() tagNS
	FuncID_tag_ImageName        // func(...String) (string, error)
	FuncID_tag_ImageTag         // func(...String) (string, error)
	FuncID_tag_ManifestName     // func(...String) (string, error)
	FuncID_tag_ManifestTag      // func(...String) (string, error)
	FuncID_touch                // func(String) (None, error)
	FuncID_values               // func() map[string]any
	FuncID_write                // func(String, ...any) (None, error)
	FuncID_yq                   // func(...any) (string, error)
	FuncID_yqObj                // func(...any) (any, error)

	// start of placeholder funcs
	FuncID_include // func(String, any) (string, error)
	FuncID_var     // func() map[string]any


func FuncNameToFuncID added in v0.8.0

func FuncNameToFuncID(name string) FuncID

FuncNameToFuncID returns FuncID of name, if name is not defined, return -1 nolint:gocyclo

func (FuncID) String added in v0.8.0

func (id FuncID) String() string


type JQOptions added in v0.8.0

type JQOptions struct {
	// Query is the jq expression
	Query string

	// resolve foo@xxx in decoded data to foo before running jq over it
	ResolveRenderingSuffixBeforeQueryStart bool

	// Variables provided when running jq
	Variables map[string]any

	// NewDecoder creates a data decoder
	// the created decoder should support both rs.AnyObject and rs.AnyObjectMap (usually {json, yaml}.NewDecoder)
	// when ResolveRenderingSuffixBeforeQueryStart is set to true
	// OPTIONAL, defaults to yaml.NewDecoder
	NewDecoder func(io.Reader) DataDecoder

	// HandleResult called for each unmarshaled object
	HandleResult textquery.QueryResultHandleFunc

type LazyAutoCloseReader added in v0.8.0

type LazyAutoCloseReader struct {
	// contains filtered or unexported fields

LazyAutoCloseReader open underlay stream on first read call, close on error (if implements io.Closer)

func NewLazyAutoCloseReader added in v0.8.0

func NewLazyAutoCloseReader(open func() (io.Reader, error)) LazyAutoCloseReader

func (*LazyAutoCloseReader) Read added in v0.8.0

func (l *LazyAutoCloseReader) Read(p []byte) (ret int, err error)

type Map added in v0.8.0

type Map any

Map type is applicable to - map[string]string - map[string]any - map[any]any

type None added in v0.8.0

type None struct{}

type Number added in v0.8.0

type Number any

Number type is applicable to - ~string - ~[]~byte - integers - floats - bool value (true as 1, false as 0)

type Slice added in v0.8.0

type Slice any

Slice type is applicable to - []string - []integer - []float - []any

type StaticFuncs added in v0.8.0

type StaticFuncs [FuncID_LAST_Static_FUNC + 1]reflect.Value

type String added in v0.8.0

type String any

String type applicable to - ~string - ~[]~byte - number (formated as decimal string) - bool value (converted to "true" or "false") - fmt.Stringer

type TemplateFuncFactory

type TemplateFuncFactory = func(rc dukkha.RenderingContext) any

type TemplateFuncs added in v0.8.0

type TemplateFuncs struct {
	// contains filtered or unexported fields

func CreateTemplateFuncs added in v0.8.0

func CreateTemplateFuncs(rc dukkha.RenderingContext) (ret TemplateFuncs)

func (*TemplateFuncs) AddOther added in v0.8.0

func (f *TemplateFuncs) AddOther(funcMap map[string]any)

func (*TemplateFuncs) GetByID added in v0.8.0

func (f *TemplateFuncs) GetByID(fid FuncID) (ret reflect.Value)

GetByID get func value by id, if fid is invalid or unsupported, returned reflect.Value will hav Valid() == false

valid fid range is [1, FuncID_LAST_Placeholder_FUNC]

func (*TemplateFuncs) GetByName added in v0.8.0

func (f *TemplateFuncs) GetByName(name string) (ret reflect.Value)

GetByName get func value by name, not limited to predefined funcs

func (*TemplateFuncs) Has added in v0.8.0

func (f *TemplateFuncs) Has(name string) bool

func (*TemplateFuncs) Override added in v0.8.0

func (f *TemplateFuncs) Override(fid FuncID, newFn reflect.Value)

type Time added in v0.8.0

type Time any

Time type applicable to - ~string - ~[]~byte - integers/floats (as seconds since unix epoch)

type WordWrapOpts added in v0.8.0

type WordWrapOpts struct {
	// The desired maximum line length in characters (defaults to 80)
	Width uint

	// Line-break sequence to insert (defaults to "\n")
	LBSeq string

WordWrapOpts defines the options to apply to the WordWrap function

Jump to

Keyboard shortcuts

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