/// <summary> /// Sets the Value property /// </summary> /// <param name="value">The value to set for the Value property </param> /// <returns>this instance</returns> public AttributeValueUpdate WithValue(AttributeValue value) { this.value = value; return this; }
internal override AttributeValue ConvertToAttributeValue() { if (!string.IsNullOrEmpty(this.Value)) { AttributeValue attribute = new AttributeValue(); if (SaveAsNumeric) { attribute.N = Value; } else { attribute.S = Value; } return attribute; } else { return null; } }
internal static DynamoDBEntry AttributeValueToDynamoDBEntry(AttributeValue attributeValue) { Primitive primitive = null; if (attributeValue.S != null) { primitive = new Primitive(attributeValue.S); } else if (attributeValue.N != null) { primitive = new Primitive(attributeValue.N, true); } else if (attributeValue.B != null) { primitive = new Primitive(attributeValue.B); } if (primitive != null) return primitive; PrimitiveList primitiveList = null; if (attributeValue.SS != null && attributeValue.SS.Count != 0) { primitiveList = new PrimitiveList(DynamoDBEntryType.String); foreach (string item in attributeValue.SS) { primitive = new Primitive(item); primitiveList.Add(primitive); } } else if (attributeValue.NS != null && attributeValue.NS.Count != 0) { primitiveList = new PrimitiveList(DynamoDBEntryType.Numeric); foreach (string item in attributeValue.NS) { primitive = new Primitive(item, true); primitiveList.Add(primitive); } } else if (attributeValue.BS != null && attributeValue.BS.Count != 0) { primitiveList = new PrimitiveList(DynamoDBEntryType.Binary); foreach (MemoryStream item in attributeValue.BS) { primitive = new Primitive(item); primitiveList.Add(primitive); } } if (primitiveList != null) return primitiveList; return null; }
internal override AttributeValue ConvertToAttributeValue() { 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; }
/// <summary> /// Sets the Value property /// </summary> /// <param name="value">The value to set for the Value property </param> /// <returns>this instance</returns> public ExpectedAttributeValue WithValue(AttributeValue value) { this.value = value; return this; }
public Key WithRangeKeyElement(AttributeValue rangeKeyElement) { this.rangeKeyElement = rangeKeyElement; return this; }
/// <summary> /// Sets the HashKeyValue property /// </summary> /// <param name="hashKeyValue">The value to set for the HashKeyValue property </param> /// <returns>this instance</returns> public QueryRequest WithHashKeyValue(AttributeValue hashKeyValue) { this.hashKeyValue = hashKeyValue; return this; }
internal override AttributeValue ConvertToAttributeValue() { AttributeValue attribute = new AttributeValue(); List<string> values = new List<string>(); foreach (var entry in Entries) { values.Add(entry.Value); } if (SaveAsNumeric) { attribute.NS = values; } else { attribute.SS = values; } return attribute; }
public Key WithHashKeyElement(AttributeValue hashKeyElement) { this.hashKeyElement = hashKeyElement; return this; }
/// <summary> /// Sets the Value property /// </summary> /// <param name="value">The value to set for the Value property </param> /// <returns>this instance</returns> public AttributeValueUpdate WithValue(AttributeValue value) { this.value = value; return(this); }
public QueryRequest WithHashKeyValue(AttributeValue hashKeyValue) { this.hashKeyValue = hashKeyValue; return(this); }
/// <summary> /// Sets the Value property /// </summary> /// <param name="value">The value to set for the Value property </param> /// <returns>this instance</returns> public ExpectedAttributeValue WithValue(AttributeValue value) { this.value = value; return(this); }
internal override AttributeValue ConvertToAttributeValue() { if (this.Value == null) return null; 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; }
/// <summary> /// Sets the RangeKeyElement property /// </summary> /// <param name="rangeKeyElement">The value to set for the RangeKeyElement property </param> /// <returns>this instance</returns> public Key WithRangeKeyElement(AttributeValue rangeKeyElement) { this.rangeKeyElement = rangeKeyElement; return(this); }
/// <summary> /// Sets the HashKeyElement property /// </summary> /// <param name="hashKeyElement">The value to set for the HashKeyElement property </param> /// <returns>this instance</returns> public Key WithHashKeyElement(AttributeValue hashKeyElement) { this.hashKeyElement = hashKeyElement; return(this); }
internal static DynamoDBEntry AttributeValueToDynamoDBEntry(AttributeValue value) { if (value.S != null) { return value.S; } else if (value.N != null) { Primitive primitive = value.N; primitive.SaveAsNumeric = true; return primitive; } else if (value.SS != null && value.SS.Count != 0) { return value.SS; } else if (value.NS != null && value.NS.Count != 0) { PrimitiveList primitiveList = value.NS; primitiveList.SaveAsNumeric = true; return primitiveList; } else { return null; } }