Use Criteria to generate realm query string Realm kotlin query criteria

I am investigating how to use Realm-Kotlin on KMM module, realm is a Non-SQL database, and it is great when I try to use it in the KMM…

Use Criteria to generate realm query string Realm kotlin query criteria

I am investigating how to use Realm-Kotlin on KMM module, realm is a Non-SQL database, and it is great when I try to use it in the KMM module, but there are some problems when I use it.

  1. The in statement is not supported when pass the list as the parameter
  2. The parameter in the query need the index as $0, $1, it’s not easy to manage it

To solve the problem, I write a Criteria class to generate the query string with correct index, also it will change the In statement to Or statement.

Criteria Description

The criteria class