2016-05-11 81 views
0

我在我的項目中將ORMLite替換爲RealmAndroid Realm數據庫刪除生成器

我們RealmQueryQueryBuilder

什麼是DeleteBuilder相似?

我如何可以替換境界API

據我所知境界DeleteBuilder查詢只支持刪除表和數據庫 本身。如果當我不得不刪除記錄一些查詢(如我們 可以DeleteBuilder做)

回答

1

沒有一個DeleteBuilder因爲如此,我們反而對大多數領域類去除方法:

Foo obj = realm.where(Foo.class).findFirst(); // Find a single object; 
obj.deleteFromRealm(); // Delete the object from Realm 

RealmResults<Foo> list = realm.where(Foo.class).findAll(); // Find all objects; 
list.deleteAllFromRealm(); // delete all items that matched your query 
list.deleteFromRealm(0); // Delete item at specific index. 

realm.delete(Foo.class); // delete all Foo's 
realm.deleteAll(); // delete all data in Realm but preserve the schema