コード例 #1
0
ファイル: geofire.py プロジェクト: whiteboxpub/pitlivebus
 def setMany(self, keys_and_locations):
     value = {}
     for key, location in keys_and_locations.iteritems():
         validate_key(key)
         validate_location(location)
         geohash = encode_geohash(location)
         encoded = encode_geofire_object(location, geohash)
         encoded['.priority'] = geohash
         value[key] = encoded
     self._firebaseRef.set(value)
コード例 #2
0
ファイル: geofire.py プロジェクト: LiqunChen/pitlivebus
 def setMany(self, keys_and_locations):
     value = {}
     for key, location in keys_and_locations.iteritems():
         validate_key(key)
         validate_location(location)
         geohash = encode_geohash(location)
         encoded = encode_geofire_object(location, geohash)
         encoded[".priority"] = geohash
         value[key] = encoded
     self._firebaseRef.set(value)
コード例 #3
0
ファイル: geofire.py プロジェクト: LiqunChen/pitlivebus
    def set(self, key, location):
        validate_key(key)
        if location:
            # Setting location to null is valid since it will remove the key
            validate_location(location)

        if location is None:
            self._firebaseRef.child(key).remove()
        else:
            geohash = encode_geohash(location)
            self._firebaseRef.child(key).set_with_priority(encode_geofire_object(location, geohash), geohash)
コード例 #4
0
ファイル: geofire.py プロジェクト: whiteboxpub/pitlivebus
    def set(self, key, location):
        validate_key(key)
        if location:
            # Setting location to null is valid since it will remove the key
            validate_location(location)

        if location is None:
            self._firebaseRef.child(key).remove()
        else:
            geohash = encode_geohash(location)
            self._firebaseRef.child(key).set_with_priority(
                encode_geofire_object(location, geohash), geohash)