objectbox / objectbox-c

C and C++ database for objects and structs
https://objectbox.io/
Apache License 2.0
211 stars 37 forks source link

to-one and to-many relations #17

Closed mohammadjalalis closed 2 years ago

mohammadjalalis commented 2 years ago

Hi, Unfortunately, there is no explanation about relations in ObjectBox documentation for c++ . Please explain how we should use to-one and to-many relations in ObjectBox c++ ? Thanks

greenrobot commented 2 years ago

Indeed the situation in C and C++ is more low-level than in higher level languages. For now https://docs.objectbox.io/relations may help a bit. Nevertheless, providing specific docs is a valid enhancement request.

mohammadjalalis commented 2 years ago

Hi, After one month, we are still waiting for a description about relations in ObjectBox C++. Please explain what should I write in fbs file after this line for one-to-many relation.

/// objectbox:relation(name=teachers,to=Teacher) ?????

table Teacher {
    id:ulong;
    name:string;
}

table Student {
    id:ulong;
    name:string;

    /// objectbox:relation(name=teachers,to=Teacher)
         ????
}
greenrobot commented 2 years ago

I would have guessed that /// objectbox:relation(name=teachers,to=Teacher) is already sufficient? Did you try?

greenrobot commented 2 years ago

No response...