Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flex property type #43

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Flex property type #43

wants to merge 5 commits into from

Conversation

greenrobot-team
Copy link
Member

@greenrobot-team greenrobot-team commented Jan 17, 2022

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

  • FlexBuffers docs indicate std::vector<uint8_t> is returned for C++; there does not appear to be an official Go implementation. Not relevant, do not add flex properties to generated binding code, only to model JSON.

Tasks

  • Generated C, C++ and Go code not correct.
  • Figure out why property UIDs after newly added one are re-set (or is this just happening for tests?).

@greenrobot

@greenrobot-team greenrobot-team force-pushed the flex-property-type branch 2 times, most recently from a3fd6eb to d63d3ab Compare January 18, 2022 15:27
@greenrobot-team
Copy link
Member Author

greenrobot-team commented Jan 24, 2022

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

  • the random seed for generating UIDs being fixed for tests (see generator.Options in test-all.go) and
  • this test not using an initial model file.

Changes are expected then.

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

@greenrobot-team
Copy link
Member Author

greenrobot-team commented Jan 24, 2022

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) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant