Beispiel #1
0
        public async Task <bool> PutMessageIfNotDuplicateAsync(ChatMessageRow row)
        {
            var putReq = new PutItemRequest()
            {
                TableName           = this.tableName,
                Item                = ToAttributeValueMap(row),
                ConditionExpression = "attribute_not_exists(messageId)",
            };

            try
            {
                await this.ddb.PutItemAsync(putReq);
            }
            catch (ConditionalCheckFailedException cex)
            {
                return(false);
            }

            return(true);
        }
Beispiel #2
0
 public async Task UpdateChatMessageAsync(ChatMessageRow row) =>
 await this.context.SaveAsync(row, this.config);
Beispiel #3
0
 private Dictionary <string, AttributeValue> ToAttributeValueMap(ChatMessageRow row)
 => this.context.ToDocument(row).ToAttributeMap();