def as_duration(self): """converts the original data type to Duration type :return: DurationWrapper type """ if self._value.getType() == Value.DUVAL: return DurationWrapper(self._value.get_duVal()) raise InvalidValueTypeException("expect duration type, but is " + self._get_type_name())
def as_double(self): """converts the original data type to Double type :return: Double value """ if self._value.getType() == Value.FVAL: return self._value.get_fVal() raise InvalidValueTypeException("expect int type, but is " + self._get_type_name())
def as_date(self): """converts the original data type to Date type :return: Date value """ if self._value.getType() == Value.DVAL: return DateWrapper(self._value.get_dVal()) raise InvalidValueTypeException("expect date type, but is " + self._get_type_name())
def as_string(self): """converts the original data type to String type :return: String value """ if self._value.getType() == Value.SVAL: return self._value.get_sVal().decode(self._decode_type) raise InvalidValueTypeException("expect string type, but is " + self._get_type_name())
def as_int(self): """converts the original data type to Int type :return: Int value """ if self._value.getType() == Value.IVAL: return self._value.get_iVal() raise InvalidValueTypeException("expect bool type, but is " + self._get_type_name())
def as_bool(self): """converts the original data type to Bool type :return: Bool value """ if self._value.getType() == Value.BVAL: return self._value.get_bVal() raise InvalidValueTypeException("expect bool type, but is " + self._get_type_name())
def as_null(self): """converts the original data type to Null type :return: Null value """ if self._value.getType() == Value.NVAL: return Null(self._value.get_nVal()) raise InvalidValueTypeException("expect NULL type, but is " + self._get_type_name())
def as_polygon(self): """converts the original data type to Polygon type :return: PolygonWrapper """ if self._geography.getType() == Geography.PGVAL: return PolygonWrapper(self._geography.get_pgVal()) raise InvalidValueTypeException("expect Polygon type, but is " + self._get_type_name())
def as_linestring(self): """converts the original data type to LineString type :return: LineStringWrapper """ if self._geography.getType() == Geography.LSVAL: return LineStringWrapper(self._geography.get_lsVal()) raise InvalidValueTypeException("expect LineString type, but is " + self._get_type_name())
def as_geography(self): """converts the original data type to GeographyWrapper type :return: GeographyWrapper type """ if self._value.getType() == Value.GGVAL: return (GeographyWrapper(self._value.get_ggVal()).set_decode_type( self._decode_type).set_timezone_offset(self._timezone_offset)) raise InvalidValueTypeException("expect geography type, but is " + self._get_type_name())
def as_path(self): """converts the original data type to PathWrapper type :return: PathWrapper type """ if self._value.getType() == Value.PVAL: return (PathWrapper(self._value.get_pVal()).set_decode_type( self._decode_type).set_timezone_offset(self._timezone_offset)) raise InvalidValueTypeException("expect path type, but is " + self._get_type_name())
def as_relationship(self): """converts the original data type to Relationship type :return: Relationship type """ if self._value.getType() == Value.EVAL: return (Relationship(self._value.get_eVal()).set_decode_type( self._decode_type).set_timezone_offset(self._timezone_offset)) raise InvalidValueTypeException("expect edge type, but is " + self._get_type_name())
def as_node(self): """converts the original data type to Node type :return: Node type """ if self._value.getType() == Value.VVAL: return (Node(self._value.get_vVal()).set_decode_type( self._decode_type).set_timezone_offset(self._timezone_offset)) raise InvalidValueTypeException("expect vertex type, but is " + self._get_type_name())
def as_time(self): """converts the original data type to Time type :return: Time value """ if self._value.getType() == Value.TVAL: return TimeWrapper(self._value.get_tVal()).set_timezone_offset( self._timezone_offset) raise InvalidValueTypeException("expect time type, but is " + self._get_type_name())
def as_map(self): """converts the original data type to map type :return: map<String, ValueWrapper> """ if self._value.getType() == Value.MVAL: result = {} kvs = self._value.get_mVal().kvs for key in kvs.keys(): result[key.decode(self._decode_type)] = ValueWrapper( kvs[key], decode_type=self._decode_type, timezone_offset=self._timezone_offset, ) return result raise InvalidValueTypeException("expect map type, but is " + self._get_type_name())
def as_set(self): """converts the original data type to set of ValueWrapper :return: set<ValueWrapper> """ if self._value.getType() == Value.UVAL: result = set() for val in self._value.get_uVal().values: result.add( ValueWrapper( val, decode_type=self._decode_type, timezone_offset=self._timezone_offset, )) return result raise InvalidValueTypeException("expect set type, but is " + self._get_type_name())