-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76bbc48
commit ea5b8f4
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <iostream> | ||
#include "cpprealm/sdk.hpp" | ||
|
||
namespace realm { | ||
struct Dog; | ||
struct Person { | ||
primary_key<int64_t> _id; | ||
std::string name; | ||
int64_t age = 0; | ||
Dog* dog; | ||
}; | ||
REALM_SCHEMA(Person, _id, name, age, dog) | ||
struct Dog { | ||
primary_key<int64_t> _id; | ||
std::string name; | ||
std::string name2; | ||
std::string name3; | ||
int64_t foo2 = 0; | ||
std::string name4; | ||
|
||
int64_t age = 0; | ||
linking_objects<&Person::dog> owners; | ||
}; | ||
REALM_SCHEMA(Dog, | ||
_id, | ||
name, | ||
name2, | ||
name3, | ||
foo2, | ||
name4, | ||
age, | ||
owners) | ||
} | ||
|
||
int main(int argc, char *argv[]) { | ||
|
||
realm::db_config config; | ||
auto realm = realm::db(std::move(config)); | ||
|
||
realm::Person p; | ||
auto managed_obj = realm.write([&realm, &p] { | ||
return realm.add(std::move(p)); | ||
}); | ||
|
||
return 0; | ||
} |