Skip to main content

MakeLiteral

Converts a given Go interface value into a Flyte core.Literal object. It handles various types including nil, collections, maps, byte arrays, structpb.Struct, core.Error, and other primitive types.

def MakeLiteral(
v: interface{}
) - > (*core.Literal, error)

Converts a given Go interface value into a core.Literal object. This function handles various types, including nil, core.Literal itself, slices, maps, byte arrays, structpb.Struct, and core.Error, to provide a standardized literal representation.

Parameters

NameTypeDescription
vinterface{}The input value to be converted into a core.Literal. This can be various types such as nil, *core.Literal, []interface{}, map[string]interface{}, []byte, *structpb.Struct, or *core.Error.

Returns

TypeDescription
(*core.Literal, error)A pointer to a core.Literal representing the input value and an error if the conversion fails.