Skip to main content

HashLiteralMap

Computes a hash for a given LiteralMap by first creating a "hashified" version where literal values are removed if their corresponding hash is set, and then encoding the computed hash as a base64 string.

def HashLiteralMap(
ctx: context.Context,
literalMap: *core.LiteralMap,
cacheIgnoreInputVars: []string
) - > string

Computes a hash for a given LiteralMap, ignoring specified input variables. This function is used to generate a unique identifier for a set of literal inputs, which can be useful for caching or tracking changes.

Parameters

NameTypeDescription
ctxcontext.ContextThe context for the operation, used for cancellation and deadlines.
literalMap*core.LiteralMapThe map of literals to be hashed. If nil or empty, an empty LiteralMap is used.
cacheIgnoreInputVars[]stringA slice of variable names whose corresponding literal values should be ignored when computing the hash. This is useful for excluding non-deterministic or irrelevant inputs from the hash calculation.

Returns

TypeDescription
stringThe base64 RawURLEncoded string representation of the computed hash, or an empty string if an error occurs.