1 DOWNLOAD
2 USAGE
project build.gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
module build.gradle:
dependencies {
compile 'com.github.pandyin:rxrealm:1.2.1'
}
-
RealmObject must have
@RxRealm
annotation -
RealmObject must define a primary key by using
@PrimaryKey
example:
@RxRealm
public class Car extends RealmObject {
@PrimaryKey
private String id;
private String color;
private int model;
...
example:
format:
fieldName + condition
example:
RxCar.get().idEqualTo(id) //condition
.colorEqualTo(color) //condition
.modelGreaterThan(model) //condition
.getAysnc(); //execute
condition operations:
equalTo
Equal-to comparison.
notEqualTo
Not-equal-to comparison.
in
In comparison.
notIn
Not-in comparison.
lessThan
Less-than comparison.
greaterThan
Greater-than comparison.
sortBy
Sorted by specific field name.
or
Logical-or two conditions.
first
Finds the first object that fulfills the query conditions.
execute operations:
getAysnc
Finds objects that fulfill the query conditions.
deleteAsync
Deletes objects that fulfill the query conditions.
countAsync
Counts objects that fulfill the query conditions.
other operation:
edit
Updates objects that fulfill the query conditions with Set operation
format:
"set" + fieldName
example:
RxCar.set(id)
.setColor(pink)
.setModel(2019)
.setAsync(); //execute
execute operation:
setAsync
Updates objects that fulfill the query conditions with provided data.