forked from mongodb/docs-realm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into docsp-32067-create-page
- Loading branch information
Showing
324 changed files
with
4,201 additions
and
1,538 deletions.
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
69 changes: 69 additions & 0 deletions
69
examples/kotlin/shared/src/commonTest/kotlin/com/mongodb/realm/realmkmmapp/SchemaSync.kt
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,69 @@ | ||
package com.mongodb.realm.realmkmmapp | ||
|
||
import io.realm.kotlin.ext.realmListOf | ||
import io.realm.kotlin.types.RealmInstant | ||
import io.realm.kotlin.types.RealmList | ||
import io.realm.kotlin.types.RealmObject | ||
import io.realm.kotlin.types.annotations.PrimaryKey | ||
import org.mongodb.kbson.ObjectId | ||
|
||
// :replace-start: { | ||
// "terms": { | ||
// "ExampleSyncObject_": "", | ||
// "SyncTask": "Task" | ||
// } | ||
// } | ||
|
||
/* | ||
******** Object Models to use in Sync examples and tests ********* | ||
*/ | ||
|
||
class Toad : RealmObject { | ||
@PrimaryKey | ||
var _id: ObjectId = ObjectId() | ||
var name: String = "" | ||
} | ||
|
||
// :snippet-start: flexible-sync-models | ||
class SyncTask : RealmObject { | ||
@PrimaryKey | ||
var _id: ObjectId = ObjectId() | ||
var taskName: String = "" | ||
var assignee: String? = null | ||
var completed: Boolean = false | ||
var progressMinutes: Int = 0 | ||
var dueDate: RealmInstant? = null | ||
} | ||
|
||
class Team : RealmObject { | ||
@PrimaryKey | ||
var _id: ObjectId = ObjectId() | ||
var teamName: String = "" | ||
var tasks: RealmList<SyncTask>? = realmListOf() | ||
var members: RealmList<String> = realmListOf() | ||
} | ||
// :snippet-end: | ||
|
||
|
||
/* | ||
** Used on Add Sync to App page ** | ||
*/ | ||
|
||
// :snippet-start: sync-to-do-model | ||
class ExampleSyncObject_List : RealmObject { | ||
@PrimaryKey | ||
var _id: ObjectId = ObjectId() | ||
var name: String = "" | ||
var ownerId: String = "" | ||
var items: RealmList<ExampleSyncObject_Item> = realmListOf() | ||
} | ||
|
||
class ExampleSyncObject_Item : RealmObject { | ||
@PrimaryKey | ||
var _id: ObjectId = ObjectId() | ||
var name: String = "" | ||
var complete: Boolean = false | ||
} | ||
// :snippet-end: | ||
|
||
// :replace-end: |
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
Oops, something went wrong.