Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseURL ¶
func ParseURL() *jsonnet.NativeFunction
ParseURL returns a jsonnet function parseUrl which returns a dictionary representing the input url
Example ¶
vm := jsonnet.MakeVM() vm.NativeFunction(f.ParseURL()) output, _ := vm.EvaluateAnonymousSnippet("main.jsonnet", `local a = std.native("parseUrl")("https://example.com/test?param=1#link"); {out:a}`) fmt.Println(output)
Output: { "out": { "fragment": "link", "host": "example.com", "hostname": "example.com", "opaque": "", "path": "/test", "port": "", "query": "param=1", "scheme": "https", "userinfo": "" } }
func SHA256 ¶
func SHA256() *jsonnet.NativeFunction
SHA256 returns a jsonnet function sha256 which returns the sha256 string representation of the input value
Example ¶
vm := jsonnet.MakeVM() vm.NativeFunction(f.SHA256()) output, _ := vm.EvaluateAnonymousSnippet("main.jsonnet", `local a = std.native("sha256")("test"); {out:a}`) fmt.Println(output)
Output: { "out": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" }
func SprigFuncs ¶ added in v0.0.2
func SprigFuncs() []*jsonnet.NativeFunction
Example ¶
vm := jsonnet.MakeVM() for _, f := range f.SprigFuncs() { vm.NativeFunction(f) } output, err := vm.EvaluateAnonymousSnippet("main.jsonnet", `local a = std.native("sprig.hello")(); local b = std.native("sprig.upper")("hSm"); local c = std.native("sprig.decryptAES")("secretkey", "30tEfhuJSVRhpG97XCuWgz2okj7L8vQ1s6V9zVUPeDQ="); [a,b,c]`) if err != nil { fmt.Println(err) } fmt.Println(output)
Output: [ "Hello!", "HSM", "plaintext" ]
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.