@@ -52,7 +52,7 @@ extern "C" {
52
52
/// When using ObjectBox as a dynamic library, you should verify that a compatible version was linked using
53
53
/// obx_version() or obx_version_is_at_least().
54
54
#define OBX_VERSION_MAJOR 4
55
- #define OBX_VERSION_MINOR 1
55
+ #define OBX_VERSION_MINOR 2
56
56
#define OBX_VERSION_PATCH 0 // values >= 100 are reserved for dev releases leading to the next minor/major increase
57
57
58
58
//----------------------------------------------
@@ -615,6 +615,76 @@ typedef enum {
615
615
OBXPropertyFlags_EXPIRATION_TIME = 65536 ,
616
616
} OBXPropertyFlags ;
617
617
618
+ /// A property type of an external system (e.g. another database) that has no default mapping to an ObjectBox type.
619
+ /// External property types numeric values start at 100 to avoid overlaps with ObjectBox's PropertyType.
620
+ /// (And if we ever support one of these as a primary type, we could share the numeric value?)
621
+ typedef enum {
622
+ /// Not a real type: represents uninitialized state and can be used for forward compatibility.
623
+ OBXExternalPropertyType_Unknown = 0 ,
624
+ /// Representing type: ByteVector
625
+ /// Encoding: 1:1 binary representation, little endian (16 bytes)
626
+ OBXExternalPropertyType_Int128 = 100 ,
627
+ // OBXExternalPropertyType_Reserved1 = 101,
628
+ /// Representing type: ByteVector
629
+ /// Encoding: 1:1 binary representation (16 bytes)
630
+ OBXExternalPropertyType_Uuid = 102 ,
631
+ /// IEEE 754 decimal128 type, e.g. supported by MongoDB
632
+ /// Representing type: ByteVector
633
+ /// Encoding: 1:1 binary representation (16 bytes)
634
+ OBXExternalPropertyType_Decimal128 = 103 ,
635
+ // OBXExternalPropertyType_Reserved2 = 104,
636
+ // OBXExternalPropertyType_Reserved3 = 105,
637
+ // OBXExternalPropertyType_Reserved4 = 106,
638
+ /// A key/value map; e.g. corresponds to a JSON object or a MongoDB document (although not keeping the key order).
639
+ /// Unlike the Flex type, this must contain a map value (e.g. not a vector or a scalar).
640
+ /// Representing type: Flex
641
+ /// Encoding: Flex
642
+ OBXExternalPropertyType_FlexMap = 107 ,
643
+ /// A vector (aka list or array) of flexible elements; e.g. corresponds to a JSON array or a MongoDB array.
644
+ /// Unlike the Flex type, this must contain a vector value (e.g. not a map or a scalar).
645
+ /// Representing type: Flex
646
+ /// Encoding: Flex
647
+ OBXExternalPropertyType_FlexVector = 108 ,
648
+ /// Placeholder (not yet used) for a JSON document.
649
+ /// Representing type: String
650
+ OBXExternalPropertyType_Json = 109 ,
651
+ /// Placeholder (not yet used) for a BSON document.
652
+ /// Representing type: ByteVector
653
+ OBXExternalPropertyType_Bson = 110 ,
654
+ /// JavaScript source code
655
+ /// Representing type: String
656
+ OBXExternalPropertyType_JavaScript = 111 ,
657
+ // OBXExternalPropertyType_Reserved5 = 112,
658
+ // OBXExternalPropertyType_Reserved6 = 113,
659
+ // OBXExternalPropertyType_Reserved7 = 114,
660
+ // OBXExternalPropertyType_Reserved8 = 115,
661
+ /// A vector (array) of Int128 values
662
+ OBXExternalPropertyType_Int128Vector = 116 ,
663
+ // OBXExternalPropertyType_Reserved9 = 117,
664
+ /// A vector (array) of Int128 values
665
+ OBXExternalPropertyType_UuidVector = 118 ,
666
+ // OBXExternalPropertyType_Reserved10 = 119,
667
+ // OBXExternalPropertyType_Reserved11 = 120,
668
+ // OBXExternalPropertyType_Reserved12 = 121,
669
+ // OBXExternalPropertyType_Reserved13 = 122,
670
+ /// The 12-byte ObjectId type in MongoDB
671
+ /// Representing type: ByteVector
672
+ /// Encoding: 1:1 binary representation (12 bytes)
673
+ OBXExternalPropertyType_MongoId = 123 ,
674
+ /// A vector (array) of MongoId values
675
+ OBXExternalPropertyType_MongoIdVector = 124 ,
676
+ /// Representing type: Long
677
+ /// Encoding: Two unsigned 32-bit integers merged into a 64-bit integer.
678
+ OBXExternalPropertyType_MongoTimestamp = 125 ,
679
+ /// Representing type: ByteVector
680
+ /// Encoding: 3 zero bytes (reserved, functions as padding), fourth byte is the sub-type,
681
+ /// followed by the binary data.
682
+ OBXExternalPropertyType_MongoBinary = 126 ,
683
+ /// Representing type: string vector with 2 elements (index 0: pattern, index 1: options)
684
+ /// Encoding: 1:1 string representation
685
+ OBXExternalPropertyType_MongoRegex = 127 ,
686
+ } OBXExternalPropertyType ;
687
+
618
688
struct OBX_model ; // doxygen (only) picks up the typedef struct below
619
689
620
690
/// Model represents a database schema and must be provided when opening the store.
@@ -657,6 +727,14 @@ OBX_C_API obx_err obx_model_entity(OBX_model* model, const char* name, obx_schem
657
727
/// @param flags See OBXEntityFlags for values (use bitwise OR to combine multiple flags)
658
728
OBX_C_API obx_err obx_model_entity_flags (OBX_model * model , uint32_t flags );
659
729
730
+ /// Set the highest ever known property id in the entity. Should always be equal to or higher than the
731
+ /// last property id of the previous version of the entity.
732
+ OBX_C_API obx_err obx_model_entity_last_property_id (OBX_model * model , obx_schema_id property_id , obx_uid property_uid );
733
+
734
+ /// Refine the definition of the entity declared by the most recent obx_model_entity() call: set the external name.
735
+ /// This is an optional name used in an external system, e.g. another database that ObjectBox syncs with.
736
+ OBX_C_API obx_err obx_model_entity_external_name (OBX_model * model , const char * external_name );
737
+
660
738
/// Starts the definition of a new property for the entity type of the last obx_model_entity() call.
661
739
/// @param name A human readable name for the property. Must be unique within the entity
662
740
/// @param type The type of property required
@@ -682,6 +760,19 @@ OBX_C_API obx_err obx_model_property_relation(OBX_model* model, const char* targ
682
760
/// @param index_uid Used to identify relations between versions of the model. Must be globally unique.
683
761
OBX_C_API obx_err obx_model_property_index_id (OBX_model * model , obx_schema_id index_id , obx_uid index_uid );
684
762
763
+ /// Refine the definition of the property declared by the most recent obx_model_property() call: set the external name.
764
+ /// This is an optional name used in an external system, e.g. another database that ObjectBox syncs with.
765
+ /// @param index_id Must be unique within this version of the model
766
+ /// @param index_uid Used to identify relations between versions of the model. Must be globally unique.
767
+ OBX_C_API obx_err obx_model_property_external_name (OBX_model * model , const char * external_name );
768
+
769
+ /// Refine the definition of the property declared by the most recent obx_model_property() call: set the external type.
770
+ /// This is an optional type used in an external system, e.g. another database that ObjectBox syncs with.
771
+ /// Note that the supported mappings from ObjectBox types to external types are limited.
772
+ /// @param index_id Must be unique within this version of the model
773
+ /// @param index_uid Used to identify relations between versions of the model. Must be globally unique.
774
+ OBX_C_API obx_err obx_model_property_external_type (OBX_model * model , OBXExternalPropertyType external_type );
775
+
685
776
/// Sets the vector dimensionality for the HNSW index of the latest property (must be of a supported vector type).
686
777
/// This a mandatory option for all HNSW indexes.
687
778
/// Note 1: vectors with higher dimensions than this value are also indexed (ignoring the higher elements).
@@ -702,7 +793,7 @@ OBX_C_API obx_err obx_model_property_index_hnsw_neighbors_per_node(OBX_model* mo
702
793
/// If indexing time is not a major concern, a value of at least 200 is recommended to improve search quality.
703
794
OBX_C_API obx_err obx_model_property_index_hnsw_indexing_search_count (OBX_model * model , uint32_t value );
704
795
705
- /// Sets flags for the HNSW index of the latest property () .
796
+ /// Sets flags for the HNSW index of the latest property.
706
797
/// For details see OBXHnswFlags and its individual values.
707
798
/// @param flags See OBXHnswFlags for values (use bitwise OR to combine multiple flags)
708
799
OBX_C_API obx_err obx_model_property_index_hnsw_flags (OBX_model * model , uint32_t flags );
@@ -728,6 +819,15 @@ OBX_C_API obx_err obx_model_property_index_hnsw_vector_cache_hint_size_kb(OBX_mo
728
819
OBX_C_API obx_err obx_model_relation (OBX_model * model , obx_schema_id relation_id , obx_uid relation_uid ,
729
820
obx_schema_id target_id , obx_uid target_uid );
730
821
822
+ /// Augments the previously defined relation with a name
823
+ OBX_C_API obx_err obx_model_relation_name (OBX_model * model , const char * name );
824
+
825
+ /// Augments the previously defined relation with an external name (used outside of ObjectBox)
826
+ OBX_C_API obx_err obx_model_relation_external_name (OBX_model * model , const char * external_name );
827
+
828
+ /// Augments the previously defined relation with an external type (used outside of ObjectBox)
829
+ OBX_C_API obx_err obx_model_relation_external_type (OBX_model * model , OBXExternalPropertyType external_type );
830
+
731
831
/// Set the highest ever known entity id in the model. Should always be equal to or higher than the
732
832
/// last entity id of the previous version of the model
733
833
OBX_C_API void obx_model_last_entity_id (OBX_model * , obx_schema_id entity_id , obx_uid entity_uid );
@@ -740,10 +840,6 @@ OBX_C_API void obx_model_last_index_id(OBX_model* model, obx_schema_id index_id,
740
840
/// last relation id of the previous version of the model.
741
841
OBX_C_API void obx_model_last_relation_id (OBX_model * model , obx_schema_id relation_id , obx_uid relation_uid );
742
842
743
- /// Set the highest ever known property id in the entity. Should always be equal to or higher than the
744
- /// last property id of the previous version of the entity.
745
- OBX_C_API obx_err obx_model_entity_last_property_id (OBX_model * model , obx_schema_id property_id , obx_uid property_uid );
746
-
747
843
//----------------------------------------------
748
844
// Store
749
845
//----------------------------------------------
0 commit comments