Пример #1
0
 def as_double(self):
     """
     :return double:
     """
     if self._value.getType() == ttypes.Value.FVAL:
         return self._value.get_fVal()
     raise InvalidValueTypeException("expect int type, but is " + self._get_type_name())
Пример #2
0
 def as_bool(self):
     """
     :return Boolean:
     """
     if self._value.getType() == ttypes.Value.BVAL:
         return self._value.get_bVal()
     raise InvalidValueTypeException("expect bool type, but is " + self._get_type_name())
Пример #3
0
 def as_datetime(self):
     """
     :return: DateTimeWrapper
     """
     if self._value.getType() == ttypes.Value.DTVAL:
         return DateTimeWrapper(self._value.get_dtVal())
     raise InvalidValueTypeException("expect datetime type, but is " + self._get_type_name())
Пример #4
0
 def as_int(self):
     """
     :return int:
     """
     if self._value.getType() == ttypes.Value.IVAL:
         return self._value.get_iVal()
     raise InvalidValueTypeException("expect bool type, but is " + self._get_type_name())
Пример #5
0
 def as_node(self):
     """
     :return: Node
     """
     if self._value.getType() == ttypes.Value.VVAL:
         return Node(self._value.get_vVal())
     raise InvalidValueTypeException("expect vertex type, but is " + self._get_type_name())
Пример #6
0
 def as_null(self):
     """
     :return: Null
     """
     if self._value.getType() == ttypes.Value.NVAL:
         return Null(self._value.get_nVal())
     raise InvalidValueTypeException("expect NULL type, but is " + self._get_type_name())
Пример #7
0
 def as_path(self):
     """
     :return: PathWrapper
     """
     if self._value.getType() == ttypes.Value.PVAL:
         return PathWrapper(self._value.get_pVal())
     raise InvalidValueTypeException("expect path type, but is " + self._get_type_name())
Пример #8
0
 def as_relationship(self):
     """
     :return: Relationship
     """
     if self._value.getType() == ttypes.Value.EVAL:
         return Relationship(self._value.get_eVal())
     raise InvalidValueTypeException("expect edge type, but is " + self._get_type_name())
Пример #9
0
 def as_string(self):
     """
     :return string:
     """
     if self._value.getType() == ttypes.Value.SVAL:
         return self._value.get_sVal().decode(self._decode_type)
     raise InvalidValueTypeException("expect string type, but is " + self._get_type_name())
Пример #10
0
 def as_set(self):
     if self._value.getType() == ttypes.Value.UVAL:
         result = set()
         for val in self._value.get_uVal().values:
             result.add(ValueWrapper(val))
         return result
     raise InvalidValueTypeException("expect set type, but is " +
                                     self._get_type_name())
Пример #11
0
 def as_list(self):
     if self._value.getType() == ttypes.Value.LVAL:
         result = []
         for val in self._value.get_lVal().values:
             result.append(ValueWrapper(val))
         return result
     raise InvalidValueTypeException("expect list type, but is " +
                                     self._get_type_name())
Пример #12
0
    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())
Пример #13
0
    def as_datetime(self):
        """converts the original data type to Datetime type

        :return: Datetime value
        """
        if self._value.getType() == Value.DTVAL:
            return DateTimeWrapper(self._value.get_dtVal()).set_timezone_offset(self._timezone_offset)
        raise InvalidValueTypeException("expect datetime type, but is " + self._get_type_name())
Пример #14
0
    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())
Пример #15
0
    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())
Пример #16
0
    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())
Пример #17
0
    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())
Пример #18
0
    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())
Пример #19
0
 def as_map(self):
     if self._value.getType() == ttypes.Value.MVAL:
         result = {}
         kvs = self._value.get_mVal().kvs
         for key in kvs.keys():
             result[key.decode(self._decode_type)] = ValueWrapper(kvs[key])
         return result
     raise InvalidValueTypeException("expect map type, but is " +
                                     self._get_type_name())
Пример #20
0
    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())
Пример #21
0
 def as_time(self):
     """
     :return: TimeWrapper
     """
     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())
Пример #22
0
    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())
Пример #23
0
    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())
Пример #24
0
    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())
Пример #25
0
    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())
Пример #26
0
    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())
Пример #27
0
    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())
Пример #28
0
    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())
Пример #29
0
 def as_list(self):
     """
     :return: list<ValueWrapper>
     """
     if self._value.getType() == Value.LVAL:
         result = []
         for val in self._value.get_lVal().values:
             result.append(
                 ValueWrapper(val,
                              decode_type=self._decode_type,
                              timezone_offset=self._timezone_offset))
         return result
     raise InvalidValueTypeException("expect list type, but is " +
                                     self._get_type_name())
Пример #30
0
 def as_date(self):
     if self._value.getType() == ttypes.Value.DVAL:
         return DateWrapper(self._value.get_dVal())
     raise InvalidValueTypeException("expect date type, but is " +
                                     self._get_type_name())