/// <inheritdoc/> public int ModifyItem(string nsName, ItemModifyMode mode, byte[] itemJson, params string[] precepts) { var result = 0; using (var writer = new CJsonWriter()) { writer.PutVString(nsName); writer.PutVarCUInt((int)DataFormat.FormatJson); //format writer.PutVarCUInt((int)mode); //mode writer.PutVarCUInt(0); //stateToken writer.PutVarCUInt(precepts.Length); //len(precepts) foreach (var precept in precepts) { writer.PutVString(precept); } reindexer_buffer.PinBufferFor(writer.CurrentBuffer, args => { using (var data = reindexer_buffer.From(itemJson)) { var rsp = Assert.ThrowIfError(() => ReindexerBinding.reindexer_modify_item_packed(Rx, args, data, _ctxInfo)); try { var reader = new CJsonReader(rsp.@out); var rawQueryParams = reader.ReadRawQueryParams(); result = rawQueryParams.count; } finally { [email protected](); } } }); } return(result); }
public void ModifyItem(ItemModifyMode mode, byte[] itemJson, params string[] precepts) { using (var writer = new CJsonWriter()) { writer.PutVarCUInt((int)DataFormat.FormatJson); // format writer.PutVarCUInt((int)mode); // mode writer.PutVarCUInt(0); // stateToken writer.PutVarCUInt(precepts.Length); // len(precepts) foreach (var precept in precepts) { writer.PutVString(precept); } reindexer_buffer.PinBufferFor(writer.CurrentBuffer, args => { using (var data = itemJson.GetHandle()) { Assert.ThrowIfError(() => ReindexerBinding.reindexer_modify_item_packed_tx(_rx, _tr, args, data.Buffer)); } }); } }
/// <inheritdoc/> public async Task ModifyItemAsync(ItemModifyMode mode, byte[] itemJson, params string[] precepts) { await CheckOperationAsync(async() => await _invoker.ModifyItemAsync(mode, itemJson, precepts).ConfigureAwait(false)).ConfigureAwait(false); }
/// <inheritdoc/> public void ModifyItem(ItemModifyMode mode, byte[] itemJson, params string[] precepts) { CheckOperation(() => _invoker.ModifyItem(mode, itemJson, precepts)); }
public Task ModifyItemAsync(ItemModifyMode mode, byte[] itemJson, params string[] precepts) { ModifyItem(mode, itemJson, precepts); return(Task.CompletedTask); }
/// <inheritdoc/> public Task <int> ModifyItemAsync(string nsName, ItemModifyMode mode, string itemJson, params string[] precepts) { return(Task.FromResult(ModifyItem(nsName, mode, itemJson, precepts))); }
/// <inheritdoc/> public int ModifyItem(string nsName, ItemModifyMode mode, string itemJson, params string[] precepts) { return(ModifyItem(nsName, mode, Encoding.UTF8.GetBytes(itemJson), precepts)); }