Struct Attr
- Namespace
- DynaSharp
- Assembly
- DynaSharp.dll
An attribute of an item without a schema, by name or document path, as Attr(string) makes it. The conditions it makes are the ones DynamoDB has for any attribute; it also goes into a hole of an interpolated expression, where it stands for the name.
public readonly struct Attr
- Inherited Members
Remarks
A path is names joined by dots, with list indexes in brackets: status, address.city, lines[2].sku. Every name becomes a
placeholder, so reserved words such as status or size need no care. A dot always separates names, so an attribute whose
name contains a dot cannot be addressed this way.
Values convert as AttributeValue does; a number keeps its .NET type.
It converts to its path, so it goes wherever a method takes a path as a string.
Constructors
Attr(string)
Initializes a new instance of the Attr struct.
public Attr(string path)
Parameters
pathstringThe name or document path.
Exceptions
- ArgumentException
pathis null or empty.
Properties
Path
Gets the name or document path.
public string Path { get; }
Property Value
Methods
BeginsWith(string)
Checks with begins_with, which is for strings and compares bytes.
public BeginsWith BeginsWith(string prefix)
Parameters
prefixstringThe prefix.
Returns
- BeginsWith
The condition.
Between(AttributeValue, AttributeValue)
Checks for a range, both bounds included. DynamoDB rejects a low bound above the high bound.
public Between<AttributeValue, AttributeValueConverter> Between(AttributeValue low, AttributeValue high)
Parameters
lowAttributeValueThe low bound.
highAttributeValueThe high bound.
Returns
- Between<AttributeValue, AttributeValueConverter>
The condition.
Between<TNumber>(TNumber, TNumber)
Checks for a range, both bounds included. DynamoDB rejects a low bound above the high bound.
public Between<TNumber, NumberConverter<TNumber>> Between<TNumber>(TNumber low, TNumber high) where TNumber : INumberBase<TNumber>
Parameters
lowTNumberThe low bound.
highTNumberThe high bound.
Returns
- Between<TNumber, NumberConverter<TNumber>>
The condition.
Type Parameters
TNumberThe type of the numbers.
Contains(AttributeValue)
Checks with contains: a string that holds the value as a substring, a set that holds it as an element, which takes a value of the element type of the set, or a list that holds an element
equal to it. An attribute that does not exist holds nothing, so the condition fails there and its Negate() holds.
public Contains<AttributeValue, AttributeValueConverter> Contains(AttributeValue operand)
Parameters
operandAttributeValueThe substring or the element.
Returns
- Contains<AttributeValue, AttributeValueConverter>
The condition.
Contains<TNumber>(TNumber)
Checks with contains whether a number set or a list holds a number.
public Contains<TNumber, NumberConverter<TNumber>> Contains<TNumber>(TNumber operand) where TNumber : INumberBase<TNumber>
Parameters
operandTNumberThe number.
Returns
- Contains<TNumber, NumberConverter<TNumber>>
The condition.
Type Parameters
TNumberThe type of the number.
Eq(AttributeValue)
Compares with =. DynamoDB compares by type first: a string never equals a number.
public Compare<AttributeValue, AttributeValueConverter> Eq(AttributeValue value)
Parameters
valueAttributeValueThe value.
Returns
- Compare<AttributeValue, AttributeValueConverter>
The condition.
Eq<TNumber>(TNumber)
Compares with =. DynamoDB compares numbers by value: 1 equals 1.0.
public Compare<TNumber, NumberConverter<TNumber>> Eq<TNumber>(TNumber value) where TNumber : INumberBase<TNumber>
Parameters
valueTNumberThe number.
Returns
- Compare<TNumber, NumberConverter<TNumber>>
The condition.
Type Parameters
TNumberThe type of the number.
Exists()
Checks with attribute_exists. An attribute with the DynamoDB null value exists.
public AttributeExists Exists()
Returns
- AttributeExists
The condition.
Ge(AttributeValue)
Compares with >=. Strings compare by their UTF-8 bytes.
public Compare<AttributeValue, AttributeValueConverter> Ge(AttributeValue value)
Parameters
valueAttributeValueThe value.
Returns
- Compare<AttributeValue, AttributeValueConverter>
The condition.
Ge<TNumber>(TNumber)
Compares with >=.
public Compare<TNumber, NumberConverter<TNumber>> Ge<TNumber>(TNumber value) where TNumber : INumberBase<TNumber>
Parameters
valueTNumberThe number.
Returns
- Compare<TNumber, NumberConverter<TNumber>>
The condition.
Type Parameters
TNumberThe type of the number.
Gt(AttributeValue)
Compares with >. Strings compare by their UTF-8 bytes.
public Compare<AttributeValue, AttributeValueConverter> Gt(AttributeValue value)
Parameters
valueAttributeValueThe value.
Returns
- Compare<AttributeValue, AttributeValueConverter>
The condition.
Gt<TNumber>(TNumber)
Compares with >.
public Compare<TNumber, NumberConverter<TNumber>> Gt<TNumber>(TNumber value) where TNumber : INumberBase<TNumber>
Parameters
valueTNumberThe number.
Returns
- Compare<TNumber, NumberConverter<TNumber>>
The condition.
Type Parameters
TNumberThe type of the number.
Le(AttributeValue)
Compares with <=. Strings compare by their UTF-8 bytes.
public Compare<AttributeValue, AttributeValueConverter> Le(AttributeValue value)
Parameters
valueAttributeValueThe value.
Returns
- Compare<AttributeValue, AttributeValueConverter>
The condition.
Le<TNumber>(TNumber)
Compares with <=.
public Compare<TNumber, NumberConverter<TNumber>> Le<TNumber>(TNumber value) where TNumber : INumberBase<TNumber>
Parameters
valueTNumberThe number.
Returns
- Compare<TNumber, NumberConverter<TNumber>>
The condition.
Type Parameters
TNumberThe type of the number.
Lt(AttributeValue)
Compares with <. Strings compare by their UTF-8 bytes.
public Compare<AttributeValue, AttributeValueConverter> Lt(AttributeValue value)
Parameters
valueAttributeValueThe value.
Returns
- Compare<AttributeValue, AttributeValueConverter>
The condition.
Lt<TNumber>(TNumber)
Compares with <.
public Compare<TNumber, NumberConverter<TNumber>> Lt<TNumber>(TNumber value) where TNumber : INumberBase<TNumber>
Parameters
valueTNumberThe number.
Returns
- Compare<TNumber, NumberConverter<TNumber>>
The condition.
Type Parameters
TNumberThe type of the number.
Ne(AttributeValue)
Compares with <>. It holds for an attribute that does not exist.
public Compare<AttributeValue, AttributeValueConverter> Ne(AttributeValue value)
Parameters
valueAttributeValueThe value.
Returns
- Compare<AttributeValue, AttributeValueConverter>
The condition.
Ne<TNumber>(TNumber)
Compares with <>. It holds for an attribute that does not exist.
public Compare<TNumber, NumberConverter<TNumber>> Ne<TNumber>(TNumber value) where TNumber : INumberBase<TNumber>
Parameters
valueTNumberThe number.
Returns
- Compare<TNumber, NumberConverter<TNumber>>
The condition.
Type Parameters
TNumberThe type of the number.
NotExists()
Checks with attribute_not_exists. An attribute with the DynamoDB null value exists.
public AttributeExists NotExists()
Returns
- AttributeExists
The condition.
ToString()
Returns the path.
public override string ToString()
Returns
- string
The path.
Operators
implicit operator string(Attr)
Converts the attribute to its path.
public static implicit operator string(Attr attribute)
Parameters
attributeAttrThe attribute.