Create with id passes

This commit is contained in:
Tobe O 2018-10-21 12:23:08 -04:00
parent f212b681c6
commit 6ed5f764d8

View file

@ -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 @override
Future<Map<String, dynamic>> update(String id, Map<String, dynamic> data, Future<Map<String, dynamic>> update(String id, Map<String, dynamic> data,
[Map<String, dynamic> params]) async { [Map<String, dynamic> params]) async {