pip_services3_expressions.variants.Variant module

class pip_services3_expressions.variants.Variant.Variant(value: Any = None)

Bases: object

Defines container for variant values.

static Empty()pip_services3_expressions.variants.Variant.Variant
property as_array

Gets variant value as variant array

property as_boolean

Gets variant value as boolean

property as_datetime

Gets variant value as datetime

property as_double

Gets variant value as double

property as_float

Gets variant value as float

property as_integer

Sets variant value as integer

property as_long

Gets variant value as long

Returns

number value

property as_object

Gets variant value as Object

property as_string

Gets variant value as string

property as_time_span

Gets variant value as time span

assign(value: pip_services3_expressions.variants.Variant.Variant)

Assigns a new value to this object.

Parameters

value – A new value to be assigned.

clear()

Clears this object and assigns a VariantType.Null type.

clone()pip_services3_expressions.variants.Variant.Variant

Cloning the variant value

Returns

The cloned value of this variant

equals(obj: Any)bool

Compares this object to the specified one.

Parameters

obj – An object to be compared.

Returns

True if objects are equal.

static from_array(value: Iterable)

Creates a new variant from Array value.

Parameters

value – a variant value.

Returns

a created variant object.

static from_boolean(value: bool)

Creates a new variant from Boolean value.

Parameters

value – a variant value.

Returns

a created variant object.

static from_datetime(value: datetime.datetime)

Creates a new variant from DateTime value.

Parameters

value – a variant value.

Returns

a created variant object.

static from_double(value: float)

Creates a new variant from Double value.

Parameters

value – a variant value.

Returns

a created variant object.

static from_float(value: float)

Creates a new variant from Float value.

Parameters

value – a variant value.

Returns

a created variant object.

static from_integer(value: int)

Creates a new variant from Integer value.

Parameters

value – a variant value.

Returns

a created variant object.

static from_long(value: int)

Creates a new variant from Long value.

Parameters

value – a variant value.

Returns

a created variant object.

static from_object(value: Any)

Creates a new variant from Object value.

Parameters

value – a variant value.

Returns

a created variant object.

static from_string(value: str)

Creates a new variant from String value.

Parameters

value – a variant value.

Returns

a created variant object.

static from_time_span(value: int)

Creates a new variant from TimeSpan value.

Parameters

value – a variant value.

Returns

a created variant object.

get_by_index(index: int)

Gets an array element by its index.

Parameters

index – an element index

Returns

a requested array element

is_empty()bool

Checks is this variant value empty.

Returns

True is this variant value is empty.

is_null()bool

Checks is this variant value Null.

Returns

True if this variant value is Null.

property length

Gets length of the array

Returns

The length of the array or 0

set_by_index(index: int, element: pip_services3_expressions.variants.Variant.Variant)

Sets an array element by its index.

Parameters
  • index – an element index

  • element – an element value

to_string()str

Returns a string value for this object.

Returns

a string value for this object.

property type

Gets a type of the variant value

Returns

the variant value type