-
public interface IDatabaseAllows for the abstract CRUD operations of an underlying database. This is a light abstraction over the database. The operations are synchronous on the calling thread, it is up to the caller to offload data operations to a non-main thread.
-
-
Method Summary
Modifier and Type Method Description abstract Unitquery(String table, Array<String> columns, String whereClause, Array<String> whereArgs, String groupBy, String having, String orderBy, String limit, Function1<ICursor, Unit> action)Query for the underlying data. abstract Unitinsert(String table, String nullColumnHack, ContentValues values)Insert a new record into the database as specified. abstract UnitinsertOrThrow(String table, String nullColumnHack, ContentValues values)Insert a new record into the database as specified. abstract Integerupdate(String table, ContentValues values, String whereClause, Array<String> whereArgs)Update one or more records into the database as specified. abstract Unitdelete(String table, String whereClause, Array<String> whereArgs)Delete one or more records from the database as specified. -
-
Method Detail
-
query
abstract Unit query(String table, Array<String> columns, String whereClause, Array<String> whereArgs, String groupBy, String having, String orderBy, String limit, Function1<ICursor, Unit> action)
Query for the underlying data.
- Parameters:
table- The table to query.columns- The columns to retrieve.whereClause- The row selection criteria (i.e.whereArgs- The row selection criteria arguments.groupBy- The group by criteria.having- The having criteria.orderBy- The order by criteria.limit- The limit criteria.action- The lambda that will be executed, allowing the caller to process the result of the query.
-
insert
abstract Unit insert(String table, String nullColumnHack, ContentValues values)
Insert a new record into the database as specified. If the insert fails, it will fail silently.
- Parameters:
table- The table to insert data into.nullColumnHack- The null column hack criteria.values- The values that should be inserted into the table.
-
insertOrThrow
abstract Unit insertOrThrow(String table, String nullColumnHack, ContentValues values)
Insert a new record into the database as specified. If the insert fails, it will throw an exception.
- Parameters:
table- The table to insert data into.nullColumnHack- The null column hack criteria.values- The values that should be inserted into the table.
-
update
abstract Integer update(String table, ContentValues values, String whereClause, Array<String> whereArgs)
Update one or more records into the database as specified.
- Parameters:
table- The table to insert data into.values- The values that should be inserted into the table.whereClause- The row selection criteria (i.e.whereArgs- The row selection criteria arguments.
-
-
-
-