remove method

Implementation

Future<DbRemoveResponse> remove() async {
  if (_id == null) {
    return DbRemoveResponse(
      code: CloudBaseExceptionCode.INVALID_PARAM,
      message: 'docId不能为空',
    );
  }

  Map<String, dynamic> query = {'_id': this._id};
  Map<String, dynamic> params = {'query': query, 'multi': false};

  CloudBaseResponse res = await _docRequest(
    'database.deleteDocument',
    params,
  );
  if (res.code != null) {
    return DbRemoveResponse(
      code: res.code,
      message: res.message,
      requestId: res.requestId,
    );
  }

  return DbRemoveResponse(
    requestId: res.requestId,
    deleted: res.data['deleted'],
  );
}