BloomServerpodRepository<T> class
CRUD repository adapter bridging Serverpod endpoint delegates to Bloom Data conventions.
Example:
final repo = BloomServerpodRepository<User>(
getAllDelegate: () => client.users.getAll(),
getByIdDelegate: (id) => client.users.getById(id),
insertDelegate: (u) => client.users.insert(u),
updateDelegate: (id, u) => client.users.update(id, u),
deleteDelegate: (id) => client.users.delete(id),
);
- Implemented types
Constructors
-
BloomServerpodRepository({required Future<
List< getAllDelegate(), required Future<T> >T?> getByIdDelegate(int id), required Future<T> insertDelegate(T item), required Future<T> updateDelegate(int id, T item), required Future<bool> deleteDelegate(int id)}) -
Creates a BloomServerpodRepository wrapping Serverpod endpoint delegates.
const
Properties
-
deleteDelegate
→ Future<
bool> Function(int id) -
Endpoint delegate deleting a record by numeric ID.
final
-
getAllDelegate
→ Future<
List< Function()T> > -
Endpoint delegate fetching all records.
final
-
getByIdDelegate
→ Future<
T?> Function(int id) -
Endpoint delegate fetching a record by numeric ID.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
insertDelegate
→ Future<
T> Function(T item) -
Endpoint delegate creating a new record.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
updateDelegate
→ Future<
T> Function(int id, T item) -
Endpoint delegate updating an existing record.
final
Methods
-
create(
T item) → Future< T> -
Creates and stores a new entity
item.override -
delete(
int id) → Future< bool> -
Deletes an entity identified by
id. Returnstrueif deleted.override -
findAll(
) → Future< List< T> > -
Retrieves all records of entity type
T.override -
findById(
int id) → Future< T?> -
Retrieves a single record of entity type
Tmatchingid, ornullif not found.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
int id, T item) → Future< T> -
Updates an existing entity
itemidentified byid.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited