I am using roomdatabase and I have a lot of categories to query.
@Query("SELECT * FROM Table_name WHERE sweets = 1")
LiveData<List<Item>> getAllSweets();
@Query("SELECT * FROM Table_name WHERE drinks = 1")
LiveData<List<Item>> getAllDrinks();
So the question is, it is possible to make one universal query and pass column name as parameter? For example:
@Query("SELECT * FROM Table_name WHERE :columnname = drinks AND :columnname = 1")
LiveData<List<Item>> getAllDrinks(String drinks);
I know that I refer to the columnName but
If columnName is type int it shouldn't be?
LiveData<List<Item>> getAllDrinks(int drinks)