Skip to content

Commit

Permalink
Add cheatsheet snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
cbullinger committed Aug 25, 2023
1 parent d53830d commit aad9f97
Show file tree
Hide file tree
Showing 42 changed files with 844 additions and 145 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
val child: ParentObjectType by backlinks(ParentObjectType::embeddedChildren)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
val child: RealmResults<ParentObjectType> by backlinks(ParentObjectType::children)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var boolOpt: Boolean? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var boolReq: Boolean = false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var byteOpt: Byte? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var byteReq: Byte = 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var charOpt: Char? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var charReq: Char = 'a'
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
val uuid1 = RealmUUID.from("46423f1b-ce3e-4a7e-812f-004cf9c42d76")
val uuid2 = RealmUUID.random()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var decimal128Opt: Decimal128? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var decimal128Req: Decimal128 = Decimal128("123.456")
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var dictionaryReq: RealmDictionary<String> = realmDictionaryOf()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var doubleOpt: Double? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var doubleReq: Double = 0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var embeddedProperty: EmbeddedObjectType? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var floatOpt: Float? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var floatReq: Float = 0.0f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var intOpt: Int? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var intReq: Int = 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var listReq: RealmList<CustomObjectType> =
realmListOf()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var longOpt: Long? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var longReq: Long = 0L
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var mutableRealmIntOpt: MutableRealmInt? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
var mutableRealmIntReq: MutableRealmInt =
MutableRealmInt.create(0)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var objectIdOpt: ObjectId? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var objectIdReq: ObjectId = ObjectId()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var realmObjectPropertyOptional: CustomObjectType? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var realmAnyOpt: RealmAny? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var realmInstantOpt: RealmInstant? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var realmInstantReq: RealmInstant = RealmInstant.now()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var setReq: RealmSet<String> = realmSetOf()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var shortOpt: Short? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var shortReq: Short = 0
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var stringOpt: String? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var stringReq: String = ""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var uuidOpt: RealmUUID? = null
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var uuidReq: RealmUUID = RealmUUID.random()
4 changes: 3 additions & 1 deletion source/sdk/kotlin/realm-database/crud/create.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ To persist a new object to a realm:
You can also upsert into a realm using specific criteria. See
:ref:`Upsert a Realm Object <kotlin-upsert-an-object>`.

.. _kotlin-create-a-collection:

Create a Collection
-------------------

You can create collections of items using
``RealmList``, ``RealmSet``, and ``RealmMap`` types.
``RealmList``, ``RealmSet``, and ``RealmDictionary`` types.

You can also register a notification handler to listen for changes to a
collection. For more information, see
Expand Down
3 changes: 3 additions & 0 deletions source/sdk/kotlin/realm-database/schemas/relationships.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.. _kotlin-relationships:
.. _kotlin-reference-realm-object:

==========================
Relationships - Kotlin SDK
Expand Down Expand Up @@ -95,6 +96,8 @@ many-to-many and a one-to-many relationship is up to your application.
instance, if a "Sushi" object has many "Fish" objects, you must specify the
"Sushi.fishes" as a ``RealmList`` or ``RealmSet`` of ``Fish`` objects.

.. _kotlin-inverse-relationships:

Inverse Relationships
---------------------

Expand Down
Loading

0 comments on commit aad9f97

Please sign in to comment.