OperationResult¶
- class aerospike_sdk.operation_result.OperationResult[source]¶
Bases:
objectTyped-accessor wrapper around a single value from a write or operate command.
The wrapped value can be any type the server returns: integer, float, string, bytes, list, map, GeoJSON, HLL, boolean, or
None. Eachget_*method coerces or rejects the underlying type explicitly so silent miscasts surface asTypeErrorrather than mysterious runtime failures elsewhere.Numeric and boolean accessors return idiomatic defaults (
0,0.0,False) when the wrapped value isNone, matching how other SDKs model an absent result for a write-then-read sequence on a bin that did not exist.Example:
result = OperationResult(42) result.get_int() # 42 result.get_string() # raises TypeError — value is int, not str result.value # 42 (raw)
See also
OperationResult.value(): Raw access without coercion.- get_long()[source]¶
Return the value as an integer;
0when the value isNone.Booleans are treated as integers per Python semantics (
True→ 1).
- get_int()[source]¶
Alias for
get_long()— Pythonintis unbounded so theint/longdistinction is purely for naming parity.- Return type:
- get_double()[source]¶
Return the value as a float;
0.0when the value isNone.Integers are widened to float for convenience; strings and other types raise.
- get_float()[source]¶
Alias for
get_double().- Return type:
- get_bool()[source]¶
Return the value as a boolean;
Falsewhen the value isNone.Accepts both native booleans and integers so values written by older clients (which encoded booleans as longs) still decode correctly.
- get_bytes()[source]¶
Return the value as
bytes;Noneis propagated.Bytearrays are accepted and converted; other types raise.