Skip to main content

MakePrimitive

Converts a Go primitive type (int, int64, float64, time.Time, time.Duration, string, or bool) into a *core.Primitive object. It returns an error if the input type is not supported.

def MakePrimitive(
v: interface{}
) - > *core.Primitive, error

Converts a Go interface value into a core.Primitive type. This function supports various primitive types including integers (int, int64), float64, time.Time, time.Duration, string, and boolean, encapsulating them within a core.Primitive structure for standardized handling.

Parameters

NameTypeDescription
vinterface{}The input value to be converted into a core.Primitive. This can be an int, int64, float64, time.Time, time.Duration, string, or bool.

Returns

TypeDescription
*core.Primitive, errorA pointer to the core.Primitive representation of the input value and an error if the conversion fails due to an unsupported type.