Skip to content

Commit 4a14a0c

Browse files
chore(firestore): support Time and Geo values
1 parent 4905402 commit 4a14a0c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

firebase/firestore/_utils.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77

88
from base64 import b64decode
9+
from google.cloud.firestore_v1._helpers import GeoPoint
10+
from google.api_core.datetime_helpers import DatetimeWithNanoseconds
911

1012

1113
def _from_datastore(data):
@@ -80,5 +82,11 @@ def _decode_datastore(value):
8082
elif value.get('mapValue'):
8183
return _from_datastore(value['mapValue'])
8284

85+
elif value.get('timestampValue'):
86+
return DatetimeWithNanoseconds.from_rfc3339(value['timestampValue'])
87+
88+
elif value.get('geoPointValue'):
89+
return GeoPoint(float(value['timestampValue']['latitude']), float(value['timestampValue']['longitude']))
90+
8391
else:
8492
raise TypeError("Cannot convert to a Python Value", value, "Invalid type", type(value))

0 commit comments

Comments
 (0)