Create with id passes
This commit is contained in:
parent
f212b681c6
commit
6ed5f764d8
1 changed files with 16 additions and 0 deletions
|
@ -29,6 +29,22 @@ class RedisService extends Service<String, Map<String, dynamic>> {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> create(Map<String, dynamic> data,
|
||||
[Map<String, dynamic> params]) async {
|
||||
String id;
|
||||
if (data['id'] != null)
|
||||
id = data['id'] as String;
|
||||
else {
|
||||
var keyVar = await respCommands.client
|
||||
.writeArrayOfBulk(['INCR', _applyPrefix('angel_redis:id')]);
|
||||
throw keyVar;
|
||||
}
|
||||
|
||||
await respCommands.set(_applyPrefix(id), json.encode(data));
|
||||
return data;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> update(String id, Map<String, dynamic> data,
|
||||
[Map<String, dynamic> params]) async {
|
||||
|
|
Loading…
Reference in a new issue