|
1 | | -// Note: the enums in this file are copied from native/bindings/objectbox-c.dart |
| 1 | +// Note: the enums in this file are copied from native/bindings/objectbox_c.dart |
2 | 2 | // to avoid package:ffi import which would break compatibility with web. |
3 | 3 |
|
4 | 4 | // ignore_for_file: public_member_api_docs, constant_identifier_names |
@@ -64,103 +64,116 @@ int propertyTypeToOBXPropertyType(PropertyType type) { |
64 | 64 | } |
65 | 65 | } |
66 | 66 |
|
67 | | -/// /// Bit-flags defining the behavior of entities. |
68 | | -/// /// Note: Numbers indicate the bit position |
| 67 | +/// Bit-flags defining the behavior of entities. |
| 68 | +/// Note: Numbers indicate the bit position |
69 | 69 | abstract class OBXEntityFlags { |
70 | | - /// /// Enable "data synchronization" for this entity type: objects will be synced with other stores over the network. |
71 | | - /// /// It's possible to have local-only (non-synced) types and synced types in the same store (schema/data model). |
| 70 | + /// Enable "data synchronization" for this entity type: objects will be synced with other stores over the network. |
| 71 | + /// It's possible to have local-only (non-synced) types and synced types in the same store (schema/data model). |
72 | 72 | static const int SYNC_ENABLED = 2; |
| 73 | + |
| 74 | + /// Makes object IDs for a synced types (SYNC_ENABLED is set) global. |
| 75 | + /// By default (not using this flag), the 64 bit object IDs have a local scope and are not unique globally. |
| 76 | + /// This flag tells ObjectBox to treat object IDs globally and thus no ID mapping (local <-> global) is performed. |
| 77 | + /// Often this is used with assignable IDs (ID_SELF_ASSIGNABLE property flag is set) and some special ID scheme. |
| 78 | + /// Note: typically you won't do this with automatically assigned IDs, set by the local ObjectBox store. |
| 79 | + /// Two devices would likely overwrite each other's object during sync as object IDs are prone to collide. |
| 80 | + /// It might be OK if you can somehow ensure that only a single device will create new IDs. |
| 81 | + static const int SHARED_GLOBAL_IDS = 4; |
73 | 82 | } |
74 | 83 |
|
75 | | -/// /// Bit-flags defining the behavior of properties. |
76 | | -/// /// Note: Numbers indicate the bit position |
| 84 | +/// Bit-flags defining the behavior of properties. |
| 85 | +/// Note: Numbers indicate the bit position |
77 | 86 | abstract class OBXPropertyFlags { |
78 | | - /// /// 64 bit long property (internally unsigned) representing the ID of the entity. |
79 | | - /// /// May be combined with: NON_PRIMITIVE_TYPE, ID_MONOTONIC_SEQUENCE, ID_SELF_ASSIGNABLE. |
| 87 | + /// 64 bit long property (internally unsigned) representing the ID of the entity. |
| 88 | + /// May be combined with: NON_PRIMITIVE_TYPE, ID_MONOTONIC_SEQUENCE, ID_SELF_ASSIGNABLE. |
80 | 89 | static const int ID = 1; |
81 | 90 |
|
82 | | - /// /// On languages like Java, a non-primitive type is used (aka wrapper types, allowing null) |
| 91 | + /// On languages like Java, a non-primitive type is used (aka wrapper types, allowing null) |
83 | 92 | static const int NON_PRIMITIVE_TYPE = 2; |
84 | 93 |
|
85 | | - /// /// Unused yet |
| 94 | + /// Unused yet |
86 | 95 | static const int NOT_NULL = 4; |
87 | 96 | static const int INDEXED = 8; |
88 | 97 |
|
89 | | - /// /// Unused yet |
| 98 | + /// Unused yet |
90 | 99 | static const int RESERVED = 16; |
91 | 100 |
|
92 | | - /// /// Unique index |
| 101 | + /// Unique index |
93 | 102 | static const int UNIQUE = 32; |
94 | 103 |
|
95 | | - /// /// Unused yet: Use a persisted sequence to enforce ID to rise monotonic (no ID reuse) |
| 104 | + /// Unused yet: Use a persisted sequence to enforce ID to rise monotonic (no ID reuse) |
96 | 105 | static const int ID_MONOTONIC_SEQUENCE = 64; |
97 | 106 |
|
98 | | - /// /// Allow IDs to be assigned by the developer |
| 107 | + /// Allow IDs to be assigned by the developer |
99 | 108 | static const int ID_SELF_ASSIGNABLE = 128; |
100 | 109 |
|
101 | | - /// /// Unused yet |
| 110 | + /// Unused yet |
102 | 111 | static const int INDEX_PARTIAL_SKIP_NULL = 256; |
103 | 112 |
|
104 | | - /// /// Used by References for 1) back-references and 2) to clear references to deleted objects (required for ID reuse) |
| 113 | + /// Used by References for 1) back-references and 2) to clear references to deleted objects (required for ID reuse) |
105 | 114 | static const int INDEX_PARTIAL_SKIP_ZERO = 512; |
106 | 115 |
|
107 | | - /// /// Virtual properties may not have a dedicated field in their entity class, e.g. target IDs of to-one relations |
| 116 | + /// Virtual properties may not have a dedicated field in their entity class, e.g. target IDs of to-one relations |
108 | 117 | static const int VIRTUAL = 1024; |
109 | 118 |
|
110 | | - /// /// Index uses a 32 bit hash instead of the value |
111 | | - /// /// 32 bits is shorter on disk, runs well on 32 bit systems, and should be OK even with a few collisions |
| 119 | + /// Index uses a 32 bit hash instead of the value |
| 120 | + /// 32 bits is shorter on disk, runs well on 32 bit systems, and should be OK even with a few collisions |
112 | 121 | static const int INDEX_HASH = 2048; |
113 | 122 |
|
114 | | - /// /// Index uses a 64 bit hash instead of the value |
115 | | - /// /// recommended mostly for 64 bit machines with values longer >200 bytes; small values are faster with a 32 bit hash |
| 123 | + /// Index uses a 64 bit hash instead of the value |
| 124 | + /// recommended mostly for 64 bit machines with values longer >200 bytes; small values are faster with a 32 bit hash |
116 | 125 | static const int INDEX_HASH64 = 4096; |
117 | 126 |
|
118 | | - /// /// The actual type of the variable is unsigned (used in combination with numeric OBXPropertyType_*). |
119 | | - /// /// While our default are signed ints, queries & indexes need do know signing info. |
120 | | - /// /// Note: Don't combine with ID (IDs are always unsigned internally). |
| 127 | + /// The actual type of the variable is unsigned (used in combination with numeric OBXPropertyType_*). |
| 128 | + /// While our default are signed ints, queries & indexes need do know signing info. |
| 129 | + /// Note: Don't combine with ID (IDs are always unsigned internally). |
121 | 130 | static const int UNSIGNED = 8192; |
122 | 131 |
|
123 | | - /// /// By defining an ID companion property, a special ID encoding scheme is activated involving this property. |
124 | | - /// /// |
125 | | - /// /// For Time Series IDs, a companion property of type Date or DateNano represents the exact timestamp. |
| 132 | + /// By defining an ID companion property, a special ID encoding scheme is activated involving this property. |
| 133 | + /// |
| 134 | + /// For Time Series IDs, a companion property of type Date or DateNano represents the exact timestamp. |
126 | 135 | static const int ID_COMPANION = 16384; |
127 | 136 |
|
128 | 137 | /// Unique on-conflict strategy: the object being put replaces any existing conflicting object (deletes it). |
129 | 138 | static const int UNIQUE_ON_CONFLICT_REPLACE = 32768; |
130 | 139 | } |
131 | 140 |
|
132 | 141 | abstract class OBXPropertyType { |
133 | | - /// ///< 1 byte |
| 142 | + /// < 1 byte |
134 | 143 | static const int Bool = 1; |
135 | 144 |
|
136 | | - /// ///< 1 byte |
| 145 | + /// < 1 byte |
137 | 146 | static const int Byte = 2; |
138 | 147 |
|
139 | | - /// ///< 2 bytes |
| 148 | + /// < 2 bytes |
140 | 149 | static const int Short = 3; |
141 | 150 |
|
142 | | - /// ///< 1 byte |
| 151 | + /// < 1 byte |
143 | 152 | static const int Char = 4; |
144 | 153 |
|
145 | | - /// ///< 4 bytes |
| 154 | + /// < 4 bytes |
146 | 155 | static const int Int = 5; |
147 | 156 |
|
148 | | - /// ///< 8 bytes |
| 157 | + /// < 8 bytes |
149 | 158 | static const int Long = 6; |
150 | 159 |
|
151 | | - /// ///< 4 bytes |
| 160 | + /// < 4 bytes |
152 | 161 | static const int Float = 7; |
153 | 162 |
|
154 | | - /// ///< 8 bytes |
| 163 | + /// < 8 bytes |
155 | 164 | static const int Double = 8; |
156 | 165 | static const int String = 9; |
157 | 166 |
|
158 | | - /// ///< Unix timestamp (milliseconds since 1970) in 8 bytes |
| 167 | + /// < Unix timestamp (milliseconds since 1970) in 8 bytes |
159 | 168 | static const int Date = 10; |
160 | 169 | static const int Relation = 11; |
161 | 170 |
|
162 | | - /// ///< Unix timestamp (nanoseconds since 1970) in 8 bytes |
| 171 | + /// < Unix timestamp (nanoseconds since 1970) in 8 bytes |
163 | 172 | static const int DateNano = 12; |
| 173 | + |
| 174 | + /// < Flexible" type, which may contain scalars (integers, floating points), strings or |
| 175 | + /// < containers (lists and maps). Note: a flex map must use string keys. |
| 176 | + static const int Flex = 13; |
164 | 177 | static const int ByteVector = 23; |
165 | 178 | static const int StringVector = 30; |
166 | 179 | } |
0 commit comments