Skip to main content

HashLiteralMap

Computes a hash for a given literal map, optionally ignoring specified input variables. It generates a copy of the literal map where each literal value is removed if its corresponding hash is set, then computes and encodes the 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 LiteralMap containing the input variables and their values to be hashed. If nil or empty, an empty LiteralMap is used.
cacheIgnoreInputVars[]stringA slice of strings representing the names of input variables that should be ignored when computing the hash. These variables will not contribute to the final hash value.

Returns

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