objectbox / objectbox-generator

ObjectBox Generator based on FlatBuffers schema files (fbs) for C and C++ (more languages in the future)
https://objectbox.io
GNU Affero General Public License v3.0
36 stars 11 forks source link

Flex property type #43

Open greenrobot-team opened 2 years ago

greenrobot-team commented 2 years ago

Using flex annotation (or another name?) on a byte array property (only this FlatBuffers type?) in the FlatBuffers schema:

// objectbox:flex
flexProperty:[byte];

Should generate a model file where the property type is 13 (which is Flex):

        {
          "id": "32:4612611183471672203",
          "name": "flexProperty",
          "type": 13
        }

Notes

Tasks

@greenrobot

greenrobot-team commented 2 years ago

Figure out why property UIDs after newly added one are re-set (or is this just happening for tests?).

This (vs. all UIDs or none changing) is caused by

Changes are expected then.

Edit: also tested generator manually with initial model file and everything works as expected.

greenrobot-team commented 2 years ago

Edit: Never mind, it's building now.

@greenrobot On macOS the Cmake build fails with

        Undefined symbols for architecture x86_64:
          "NewEntityName::_OBX_MetaInfo::fromFlatBuffer(void const*, unsigned long, NewEntityName&)", referenced from:
              obx::Box<NewEntityName>::get(unsigned long long, NewEntityName&) in step-2.cpp.o
        ld: symbol(s) not found for architecture x86_64
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        make[4]: *** [TestCpp] Error 1
        make[3]: *** [CMakeFiles/TestCpp.dir/all] Error 2
        make[2]: *** [CMakeFiles/TestCpp.dir/rule] Error 2
        make[1]: *** [TestCpp] Error 2

Does that ring a bell? The signature of the generated code (fromFlatBuffer) and the call from the C library (in ::get) do not appear to have changed between C lib version 14 and 15. There also doesn't appear to be a differentiation for macOS that I can see.

Edit: the generated method has this signature:

void NewEntityName::_OBX_MetaInfo::fromFlatBuffer(const void* data, size_t, NewEntityName& outObject) {