Backward

The Backward registry offers functions to maintain compatibility with older Sprig versions, ensuring legacy templates continue to work seamlessly after updates.

circle-info

You can easily import all the functions from the backward registry by including the following import statement in your code

import "github.com/go-sprout/sprout/registry/backward"

Deprecated functions

fail ⚠️

The Fail function creates an error with a specified message and returns a nil pointer along with the error. It is generally used to indicate failure in functions that return both a pointer and an error.

circle-exclamation

Signature

Must version

{{ fail "Operation failed" }} // Output: nil, error with "Operation failed"

urlParse ⚠️

The function parses a given URL string and returns a map containing its components, such as the scheme, host, path, query parameters, and more, allowing easy access and manipulation of the different parts of a URL.

circle-exclamation

Signature

Must version

{{ "https://example.com/path?query=1#fragment" | urlParse }}
// Output: map[fragment:fragment host:example.com hostname:example.com path:path query:query scheme:https]

urlJoin ⚠️

The function constructs a URL string from a given map of URL components, assembling the various parts such as scheme, host, path, and query parameters into a complete URL.

circle-exclamation

Signature

Must version

getHostByName⚠️

The function returns a random IP address associated with a given hostname, providing a way to resolve a hostname to one of its corresponding IP addresses.

circle-exclamation

Signature

Must version

Last updated