internal override AttributeValue ConvertToAttributeValue(AttributeConversionConfig conversionConfig) { return new AttributeValue { NULL = true }; }
internal override AttributeValue ConvertToAttributeValue(AttributeConversionConfig conversionConfig) { var map = new Dictionary <string, AttributeValue>(StringComparer.Ordinal); foreach (var item in currentValues) { var key = item.Key; var entry = item.Value; AttributeValue entryAttributeValue; using (conversionConfig.CRT.Track(entry)) { entryAttributeValue = entry.ConvertToAttributeValue(conversionConfig); } if (entryAttributeValue != null) { map[key] = entryAttributeValue; } } var attributeValue = new AttributeValue(); attributeValue.M = map; attributeValue.IsMSet = true; return(attributeValue); }
internal override AttributeValue ConvertToAttributeValue(AttributeConversionConfig conversionConfig) { return(new AttributeValue { BOOL = Value }); }
internal override AttributeValue ConvertToAttributeValue(AttributeConversionConfig conversionConfig) { using (conversionConfig.CRT.Track(Value)) { var convertedEntry = Convert(conversionConfig.Conversion); return(convertedEntry.ConvertToAttributeValue(conversionConfig)); } }
internal AttributeValueUpdate ConvertToAttributeUpdateValue(AttributeConversionConfig conversionConfig) { AttributeValue attributeValue = ConvertToAttributeValue(conversionConfig); AttributeValueUpdate attributeUpdate = new AttributeValueUpdate(); if (attributeValue == null) { attributeUpdate.Action = "DELETE"; } else { attributeUpdate.Action = "PUT"; attributeUpdate.Value = attributeValue; } return(attributeUpdate); }
internal ExpectedAttributeValue ConvertToExpectedAttributeValue(AttributeConversionConfig conversionConfig) { AttributeValue attributeValue = ConvertToAttributeValue(conversionConfig); ExpectedAttributeValue expectedAttribute = new ExpectedAttributeValue(); if (attributeValue == null) { expectedAttribute.Exists = false; } else { expectedAttribute.Exists = true; expectedAttribute.Value = attributeValue; } return(expectedAttribute); }
internal override AttributeValue ConvertToAttributeValue(AttributeConversionConfig conversionConfig) { if (Entries == null || Entries.Count == 0) { return(null); } AttributeValue attribute = new AttributeValue(); if (Type == DynamoDBEntryType.Numeric || Type == DynamoDBEntryType.String) { List <string> values = new List <string>(); foreach (var entry in Entries) { values.Add(entry.StringValue); } if (Type == DynamoDBEntryType.Numeric) { attribute.NS = values; } else { attribute.SS = values; } } else if (Type == DynamoDBEntryType.Binary) { List <MemoryStream> values = new List <MemoryStream>(); foreach (var entry in Entries) { MemoryStream stream = new MemoryStream(entry.AsByteArray()); values.Add(stream); } attribute.BS = values; } else { throw new InvalidOperationException("Unsupported Type"); } return(attribute); }
internal override AttributeValue ConvertToAttributeValue(AttributeConversionConfig conversionConfig) { if (this.Value == null) { return(null); } if (conversionConfig.IsEmptyStringValueEnabled) { if (this.Type != DynamoDBEntryType.Binary && StringValue == null) { return(null); } } else { if (this.Type != DynamoDBEntryType.Binary && string.IsNullOrEmpty(this.StringValue)) { return(null); } } AttributeValue attribute = new AttributeValue(); switch (this.Type) { case DynamoDBEntryType.Numeric: attribute.N = StringValue; break; case DynamoDBEntryType.String: attribute.S = StringValue; break; case DynamoDBEntryType.Binary: byte[] bytes = (byte[])Value; attribute.B = new MemoryStream(bytes); break; } return(attribute); }
internal Dictionary <string, ExpectedAttributeValue> ToExpectedAttributeMap(DynamoDBEntryConversion conversion, IEnumerable <string> epochAttributes, bool isEmptyStringValueEnabled) { if (conversion == null) { throw new ArgumentNullException("conversion"); } Dictionary <string, ExpectedAttributeValue> ret = new Dictionary <string, ExpectedAttributeValue>(); foreach (var kvp in currentValues) { var attributeName = kvp.Key; var entry = kvp.Value; ApplyEpochRules(epochAttributes, attributeName, ref entry); var attributeConversionConfig = new AttributeConversionConfig(conversion, isEmptyStringValueEnabled); ret.Add(attributeName, entry.ConvertToExpectedAttributeValue(attributeConversionConfig)); } return(ret); }
internal abstract AttributeValue ConvertToAttributeValue(AttributeConversionConfig conversionConfig);