Encoding
The Encoding registry offers methods for encoding and decoding data in different formats, allowing for flexible data representation and storage within your templates.
You can easily import all the functions from the encoding
registry by including the following import statement in your code
base64Encode
The function encodes a given string into its Base64 representation, converting the data into a text format suitable for transmission or storage in systems that support Base64 encoding.
Signature |
base64Decode
The function decodes a Base64 encoded string back to its original form. If the input string is not valid Base64, it returns an error message.
Signature |
base32Encode
The function encodes a given string into its Base32 representation, converting the data into a text format that is compatible with systems supporting Base32 encoding.
Signature |
base32Decode
The function decodes a Base32 encoded string back to its original form. If the input is not valid Base32, it returns an error message.
Signature |
fromJson
The function converts a JSON string into a corresponding Go data structure, enabling easy manipulation of the JSON data in a Go environment.
Signature |
toJson
The function converts a Go data structure into a JSON string, allowing the data to be easily serialized for storage, transmission, or further processing.
Signature |
toPrettyJson
The function converts a Go data structure into a pretty-printed JSON string, formatting the output with indentation and line breaks for better readability.
Signature |
toRawJson
The function converts a Go data structure into a JSON string without escaping HTML characters, preserving the raw content as it is.
Signature |
fromYaml
The function deserializes a YAML string into a Go map, allowing the structured data from YAML to be used and manipulated within a Go program.
Signature |
toYaml
The function serializes a Go data structure into a YAML string, converting the data into a format suitable for YAML representation.
Signature |
Last updated