public async Task UpdateItemAsync <T>(DynamoUpdateItem update, CancellationToken token = default) { var request = ToUpdateItemRequest <T>(update); await ExecAsync(async() => await DynamoDb.UpdateItemAsync(request, token).ConfigAwait()).ConfigAwait(); }
public async Task <bool> UpdateItemAsync <T>(UpdateExpression <T> update, CancellationToken token = default) { try { await ExecAsync(async() => await DynamoDb.UpdateItemAsync(update, token).ConfigAwait()).ConfigAwait(); return(true); } catch (ConditionalCheckFailedException) { return(false); } }
public async Task <T> UpdateItemNonDefaultsAsync <T>(T value, bool returnOld = false, CancellationToken token = default) { var table = DynamoMetadata.GetTable <T>(); var request = new UpdateItemRequest { TableName = table.Name, Key = Converters.ToAttributeKey(this, table, value), AttributeUpdates = Converters.ToNonDefaultAttributeValueUpdates(this, value, table), ReturnValues = returnOld ? ReturnValue.ALL_OLD : ReturnValue.NONE, }; var response = await ExecAsync(async() => await DynamoDb.UpdateItemAsync(request, token).ConfigAwait()).ConfigAwait(); if (response.Attributes.IsEmpty()) { return(default);