DbRepository<T extends DbModel> class
abstract
Represents a table in db with CRUD and other helping functions.
Constructors
- DbRepository(T _factoryOfT(), {String? specialDb, ConnectionSettings? connectionSettings})
- Create an instance of DbRepository
Properties
- connectionSettings ↔ ConnectionSettings?
-
getter/setter pair
- 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. -
createTable(
) → Future< bool> -
delete(
{bool withRelatedItems = true, ConditionQuery where(T e)?, bool isolatedConnection = false}) → 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, bool isolatedConnection = false}) → Future - Remove all entries in this table permenantly.
-
deleteEntry(
T entry, {bool isolatedConnection = false}) → Future< int> - Delete an entry from this table.
-
dropTable(
) → Future< bool> -
entryFromMap(
ResultRow r) → T - Generate an entry using json map.
-
getEntriesByIds(
List< int> ids, {bool isolatedConnection = false}) → Future<List< T> > - Get a collection of entries from this table using thier ids.
-
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), DbRepository<O> otherJoinProvider, ConditionQuery where(T e), int offset, int limit, List<FieldWithValue> groupBy(T e), List<FieldOrder> orderBy(T e), bool isolatedConnection) → Future - Apply inner join.
-
insertCollection(
List< T> entries, {bool isolatedConnection = false}) → 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, {bool isolatedConnection = false}) → Future< bool> - Insert new entry to this table.
-
leftJoinQuery<
O extends DbModel> (List< QueryPart> queries(T a, O? b), ConditionQuery joinCondition(T a, O b), DbRepository<O> otherJoinProvider, ConditionQuery where(T e), int offset, int limit, List<FieldWithValue> groupBy(T e), List<FieldOrder> orderBy(T e), bool isolatedConnection) → Future - Apply left join.
-
loadAllEntriesByPaging(
{required DataPageQuery< T> pageQuery, ConditionQuery where(T model)?, List<FieldOrder> orderBy(T model)?, List<FieldWithValue> desiredFields(T model)?, bool isolatedConnection = false}) → Future<DataPageQueryResult< T> > - Make query with pagination.
-
loadEntryById(
int id, {bool isolatedConnection = false}) → Future< T?> - Get an entry by its 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 e)?, ConditionQuery having(T e)?, int? offset, int? limit, List<FieldWithValue> groupBy(T e)?, List<FieldOrder> orderBy(T e)?, bool isolatedConnection = false}) → 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 e)?, List< FieldOrder> orderBy(T e)?, int? offset, int? limit, List<FieldWithValue> desiredFields(T e)?, bool isolatedConnection = false}) → 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)?, bool isolatedConnection = false}) → Future<T?> - Get first entry matching the query.
-
selectFirstWhere(
ConditionQuery where(T model), {List< FieldOrder> orderBy(T model)?, int? offset, List<FieldWithValue> desiredFields(T model)?, bool isolatedConnection = false}) → Future<T?> -
Get first entry matching
where
. -
selectWhere(
ConditionQuery where(T e), {List< FieldOrder> orderBy(T e)?, int? offset, int? limit, List<FieldWithValue> desiredFields(T e)?, bool isolatedConnection = false}) → Future<List< T> > -
Get
entries
from the table that matchwhere
condition. -
toString(
) → String -
A string representation of this object.
inherited
-
updateCollectionById(
List< T> entries, {bool isolatedConnection = false}) → Future<void> -
Update a collection of
entries
in this table. -
updateEntry(
T entry, {bool isolatedConnection = false}) → Future< bool> - Update an entry in this table.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited