create abstract method
- Map<
String, dynamic> map, - DbPrincipal principal, {
- CreatePolicy? createPolicy,
- RepositoryTransaction? transaction,
Inserts the map as a new entity in the database collection.
This method expects a principal
parameter, which
identifies the user performing the request. Implementations
may add metadata to the entity based on that principal,
like for instance a key identifying a tenant and logging.
If a non-empty value is passed to the permission
parameter,
the implementation of this method is expected to validate
if the user represented by the principal
does have the
permission before actually inserting the entity. Otherwise,
an error is thrown.
It is possible that the database engine makes changes to the inserted entity, like for instance adding an automatically incremented key (primary key) to the entity.
Implementations of this method are required to return the updated entity.
Implementation
Future<Map<String, dynamic>> create(
Map<String, dynamic> map,
DbPrincipal principal, {
CreatePolicy? createPolicy,
RepositoryTransaction? transaction,
});