11from objectbox .model import *
2+ from objectbox .model .properties import IndexType
23import numpy as np
34from datetime import datetime
45from typing import Generic , Dict , Any
78@Entity (id = 1 , uid = 1 )
89class TestEntity :
910 id = Id (id = 1 , uid = 1001 )
10- str = Property (str , id = 2 , uid = 1002 )
11+ # TODO Enable indexing dynamically, e.g. have a constructor to enable index(es).
12+ # E.g. indexString=False (defaults to false). Same for bytes.
13+ str = Property (str , id = 2 , uid = 1002 , index = True )
1114 bool = Property (bool , id = 3 , uid = 1003 )
12- int64 = Property (int , type = PropertyType .long , id = 4 , uid = 1004 )
13- int32 = Property (int , type = PropertyType .int , id = 5 , uid = 1005 )
14- int16 = Property (int , type = PropertyType .short , id = 6 , uid = 1006 )
15+ int64 = Property (int , type = PropertyType .long , id = 4 , uid = 1004 , index = True )
16+ int32 = Property (int , type = PropertyType .int , id = 5 , uid = 1005 , index = True , index_type = IndexType . hash )
17+ int16 = Property (int , type = PropertyType .short , id = 6 , uid = 1006 , index_type = IndexType . hash )
1518 int8 = Property (int , type = PropertyType .byte , id = 7 , uid = 1007 )
1619 float64 = Property (float , type = PropertyType .double , id = 8 , uid = 1008 )
1720 float32 = Property (float , type = PropertyType .float , id = 9 , uid = 1009 )
18- bytes = Property (bytes , id = 10 , uid = 1010 )
21+ bytes = Property (bytes , id = 10 , uid = 1010 , index_type = IndexType . hash64 )
1922 ints = Property (np .ndarray , type = PropertyType .intVector , id = 11 , uid = 1011 )
2023 longs = Property (np .ndarray , type = PropertyType .longVector , id = 12 , uid = 1012 )
2124 floats = Property (np .ndarray , type = PropertyType .floatVector , id = 13 , uid = 1013 )
@@ -32,6 +35,7 @@ class TestEntity:
3235 def __init__ (self , string : str = "" ):
3336 self .str = string
3437
38+
3539@Entity (id = 2 , uid = 2 )
3640class TestEntityDatetime :
3741 id = Id (id = 1 , uid = 2001 )
0 commit comments