Skip to main content

ExtractFromLiteral

Extracts the underlying value from a core.Literal object, handling various literal types including scalars, collections, maps, and offloaded metadata. It recursively extracts values from nested literals like unions and collections.

def ExtractFromLiteral(
literal: *core.Literal
) - > interface{}

Extracts the underlying value from a core.Literal object. This function recursively processes nested literals, collections, and maps to return the concrete data type.

Parameters

NameTypeDescription
literal*core.LiteralThe core.Literal object from which to extract the underlying value.

Returns

TypeDescription
interface{}The extracted value, which can be a primitive type (integer, float, string, boolean, datetime, duration), a URI for binary, blob, schema, or structured dataset, a generic scalar, a collection of extracted values, a map of string keys to extracted values, or nil if the literal represents NoneType. An error is returned if the literal type is unsupported.