DbTableProvider<T extends DbModel> class abstract

Represents a table in db with CRUD and other helping functions.

Constructors

DbTableProvider(T _factoryOfT(), {String? specialDbFile})
Create an instance of DbTableProvider

Properties

hashCode → int
The hash code for this object.
no setterinherited
idColumnName → String
Get the id column name in this table.
no setter
isProcessing ↔ bool
Get weather this provider is processing an operation.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
tableName → String
Get the name of this table.
no setter

Methods

addEntryChangeListner(dynamic lisnter(EntryChangeType changeType, T entry)) → void
Add a listener that be called when some EntryChangeType occured.
addListener(dynamic listener()) → void
Add a listener that be called when some change occured.
closeDB() → Future<bool>
Close this table database. Cannot be accessed anymore
countEntries({ConditionQuery where(T model)?}) → Future<int>
Count the entries of this table with where if required.
delete({bool withRelatedItems = true, ConditionQuery where(T model)?}) → Future
Delete entries from this table, if where is null it will delete every entry, otherwise it delete only matching entries.
deleteAllEntries({bool withRelatedItems = true}) → Future
Remove all entries in this table permenantly.
deleteEntry(T entry) → Future<int>
Delete an entry from this table.
entryFromMap(Map<String, dynamic> r) → T
Generate an entry using json map.
getEntriesByIds(List<int> ids) → Future<List<T>>
Get a collection of entries from this table using thier ids.
getIndices(T e) → List<List<FieldWithValue>>?
getRandomEntry({ConditionQuery where(T model)?}) → Future<T?>
Get a random entry from this table.
innerJoinQuery<O extends DbModel>(List<QueryPart> queries(T a, O? b), ConditionQuery joinCondition(T a, O? b), DbTableProvider<O> otherJoinProvider, ConditionQuery where(T e), int offset, int limit, List<FieldWithValue> groupBy(T e), List<FieldOrder> orderBy(T e)) → Future
Apply inner join.
insertCollection(List<T> entries) → Future<void>
Insert a collection of entries to this table.
insertCollectionInTransaction(List<T> entries) → Future<bool>
Insert a collection of entries using a transaction.
insertEntry(T entry) → Future<bool>
Insert new entry to this table.
insertOrUpdateCollectionByServerId(List<T> entries, {List<FieldWithValue>? fieldsToCopy}) → Future<void>
Insert or update a collection of entries, with considering DbModel.serverId as the key.
leftJoinQuery<O extends DbModel>(List<QueryPart> queries(T a, O? b), ConditionQuery joinCondition(T a, O b), DbTableProvider<O> otherJoinProvider, ConditionQuery where(T e), int offset, int limit, List<FieldWithValue> groupBy(T e), List<FieldOrder> orderBy(T e)) → Future
Apply left join.
loadAllEntriesByPaging({required DataPageQuery<T> pageQuery, ConditionQuery where(T model)?, List<FieldOrder> orderBy(T model)?, List<FieldWithValue> desiredFields(T model)?}) → Future<DataPageQueryResult<T>>
Make query with pagination.
loadEntryById(int id) → Future<T?>
Get an entry by its id as key.
loadEntryByServerId(int serverId) → Future<T?>
Get an entry by its server id as key.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query({List<QueryPart> queries(T e)?, ConditionQuery where(T model)?, ConditionQuery having(T model)?, int? offset, int? limit, List<FieldWithValue> groupBy(T model)?, List<FieldOrder> orderBy(T model)?}) → Future
Query some rows with specified fields from this table.
queryFirstValue(QueryPart query(T model), {ConditionQuery where(T model)?, List<FieldOrder> orderBy(T model)?}) → Future
Get first row first field value
removeEntryChangeListner(dynamic lisnter(EntryChangeType changeType, T entry)) → void
rempve a listener from change listners
removeListener(dynamic listener()) → void
Remove a change listner.
select({ConditionQuery where(T model)?, List<FieldOrder> orderBy(T model)?, int? offset, int? limit, List<FieldWithValue> desiredFields(T model)?}) → Future<List<T>>
Get entries from the table.
selectFirst({ConditionQuery where(T model)?, List<FieldOrder> orderBy(T model)?, int? offset, List<FieldWithValue> desiredFields(T model)?}) → Future<T?>
Get first entry matching the query.
selectFirstWhere(ConditionQuery where(T e), {List<FieldOrder> orderBy(T model)?, int? offset, List<FieldWithValue> desiredFields(T model)?}) → Future<T?>
Get first entry matching where.
selectWhere(ConditionQuery where(T e), {List<FieldOrder> orderBy(T model)?, int? offset, int? limit, List<FieldWithValue> desiredFields(T model)?}) → Future<List<T>>
Get entries from the table that match where condition.
toString() → String
A string representation of this object.
inherited
updateCollectionById(List<T> entries) → Future<void>
Update a collection of entries in this table.
updateCollectionByServerId(List<T> entries) → Future<void>
Update a collection of entries in this table.
updateEntry(T entry) → Future<bool>
Update an entry in this table.
updateEntryByServerId(T entry) → Future<bool>
Update an entry by its serverId as key.
vacuumDb() → Future
Vacuum this table database.

Operators

operator ==(Object other) → bool
The equality operator.
inherited