searchToStream method
Future<Stream<Map<String, dynamic> > >
searchToStream(
- SearchCriteria criteria,
- DbPrincipal principal, {
- SearchPolicy? searchPolicy,
- RepositoryTransaction? transaction,
Searches entities according to criteria
,
returning all the entities that fit the constraints.
Implementations should filter the search results
limiting them to entities belonging to
the tenant of the principal
.
By default, this method will search
all entities in the collection owned by
the principal
, except when the
permission
parameter is given.
When the permission
parameter has a
non-empty argument and the user identified
by the principal
has that permission,
then all the entities in the collection
belonging to the tenant within the criteria
defined by the criteria
, regardless of
their owner within the tenant.
Implementation
@override
Future<Stream<Map<String, dynamic>>> searchToStream(
SearchCriteria criteria,
DbPrincipal principal, {
SearchPolicy? searchPolicy,
RepositoryTransaction? transaction,
}) async {
searchPolicy ??= this.searchPolicy;
var filters = _createFilters(criteria);
var filterQuery = filters.item1;
var parameters = filters.item2;
var page = _createPage(
filterQuery,
criteria,
parameters,
principal,
searchPolicy,
transaction: transaction,
);
return page;
}