Repository<T> class abstract

Constructors

Repository(String tableName, {String primaryKeyColumn = 'id', bool autoIncrementPrimaryKey = true})

Properties

autoIncrementPrimaryKey bool
Whether the primary key is auto-generated (SERIAL/AUTO_INCREMENT)
final
connection DatabaseConnection
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
primaryKeyColumn String
Primary key column name (default: 'id')
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tableName String
final

Methods

delete(dynamic id) Future<void>
Delete entity by ID
deleteEntity(T entity) Future<void>
Delete entity
executeCount(String sql, Map<String, dynamic> parameters) Future<int>
Execute count query (internal)
executeProcedure(String name, {List? parameters}) StoredProcedure
Execute stored procedure
executeQuery(String sql, Map<String, dynamic> parameters, List<String> includes) Future<List<T>>
Execute query (internal)
executeRawQuery(String sql, [Map<String, dynamic>? parameters]) RawQuery
Execute raw SQL query
findById(dynamic id) Future<T?>
Find by primary key
fromRow(Map<String, dynamic> row) → T
Convert database row to entity
getAll() Future<List<T>>
Get all records
loadRelationships(T entity, List<String> includes) Future<void>
Load relationships for an entity (to be implemented by generated code)
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
query() QueryBuilder<T>
Create query builder
save(T entity) Future<T>
Save entity (INSERT only) Skips primary key column if autoIncrementPrimaryKey is true and value is null
setConnection(DatabaseConnection conn) → void
Initialize repository with connection
toRow(T entity) Map<String, dynamic>
Convert entity to database row
toString() String
A string representation of this object.
inherited

Operators

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