We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent dfbf011 commit 054d380Copy full SHA for 054d380
3 files changed
example/tasks/model.py
@@ -6,8 +6,8 @@ class Task:
6
id = Id(id=1, uid=1001)
7
text = String(id=2, uid=1002)
8
9
- date_created = Date(id=3, uid=1003)
10
- date_finished = Date(id=4, uid=1004)
+ date_created = Date(py_type=int, id=3, uid=1003)
+ date_finished = Date(py_type=int, id=4, uid=1004)
11
12
13
def get_objectbox_model():
objectbox/model/properties.py
@@ -302,12 +302,12 @@ def __init__(self, id : int = 0, uid : int = 0, **kwargs):
302
303
# Date Properties
304
class Date(_NumericProperty):
305
- def __init__(self, id : int = 0, uid : int = 0, **kwargs):
306
- super(Date, self).__init__(int, type=PropertyType.date, id=id, uid=uid, **kwargs)
+ def __init__(self, py_type = datetime, id : int = 0, uid : int = 0, **kwargs):
+ super(Date, self).__init__(py_type, type=PropertyType.date, id=id, uid=uid, **kwargs)
307
308
class DateNano(_NumericProperty):
309
310
- super(DateNano, self).__init__(int, type=PropertyType.dateNano, id=id, uid=uid, **kwargs)
+ super(DateNano, self).__init__(py_type, type=PropertyType.dateNano, id=id, uid=uid, **kwargs)
311
312
# Flex Property
313
class Flex(Property):
tests/model.py
@@ -31,17 +31,17 @@ class TestEntity:
31
longs_list = Int64List(id=22, uid=1022)
32
floats_list = Float32List(id=23, uid=1023)
33
doubles_list = Float64List(id=24, uid=1024)
34
- date = Date(id=25, uid=1025)
35
- date_nano = DateNano(id=26, uid=1026)
+ date = Date(py_type=int, id=25, uid=1025)
+ date_nano = DateNano(py_type=int, id=26, uid=1026)
36
flex = Flex(id=27, uid=1027)
37
transient = "" # not "Property" so it's not stored
38
39
40
@Entity(id=2, uid=2)
41
class TestEntityDatetime:
42
id = Id(id=1, uid=2001)
43
- date = Property(datetime, type=PropertyType.date, id=2, uid=2002)
44
- date_nano = Property(datetime, type=PropertyType.dateNano, id=3, uid=2003)
+ date = Date(id=2, uid=2002)
+ date_nano = DateNano(id=3, uid=2003)
45
46
47
@Entity(id=3, uid=3)
0 commit comments