Table of Contents

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

path string

The name or document path.

Exceptions

ArgumentException

path is null or empty.

Properties

Path

Gets the name or document path.

public string Path { get; }

Property Value

string

Methods

BeginsWith(string)

Checks with begins_with, which is for strings and compares bytes.

public BeginsWith BeginsWith(string prefix)

Parameters

prefix string

The 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

low AttributeValue

The low bound.

high AttributeValue

The 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

low TNumber

The low bound.

high TNumber

The high bound.

Returns

Between<TNumber, NumberConverter<TNumber>>

The condition.

Type Parameters

TNumber

The 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

operand AttributeValue

The 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

operand TNumber

The number.

Returns

Contains<TNumber, NumberConverter<TNumber>>

The condition.

Type Parameters

TNumber

The 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

value AttributeValue

The 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

value TNumber

The number.

Returns

Compare<TNumber, NumberConverter<TNumber>>

The condition.

Type Parameters

TNumber

The 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

value AttributeValue

The 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

value TNumber

The number.

Returns

Compare<TNumber, NumberConverter<TNumber>>

The condition.

Type Parameters

TNumber

The type of the number.

Gt(AttributeValue)

Compares with >. Strings compare by their UTF-8 bytes.

public Compare<AttributeValue, AttributeValueConverter> Gt(AttributeValue value)

Parameters

value AttributeValue

The 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

value TNumber

The number.

Returns

Compare<TNumber, NumberConverter<TNumber>>

The condition.

Type Parameters

TNumber

The type of the number.

Le(AttributeValue)

Compares with <=. Strings compare by their UTF-8 bytes.

public Compare<AttributeValue, AttributeValueConverter> Le(AttributeValue value)

Parameters

value AttributeValue

The 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

value TNumber

The number.

Returns

Compare<TNumber, NumberConverter<TNumber>>

The condition.

Type Parameters

TNumber

The type of the number.

Lt(AttributeValue)

Compares with <. Strings compare by their UTF-8 bytes.

public Compare<AttributeValue, AttributeValueConverter> Lt(AttributeValue value)

Parameters

value AttributeValue

The 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

value TNumber

The number.

Returns

Compare<TNumber, NumberConverter<TNumber>>

The condition.

Type Parameters

TNumber

The 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

value AttributeValue

The 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

value TNumber

The number.

Returns

Compare<TNumber, NumberConverter<TNumber>>

The condition.

Type Parameters

TNumber

The 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

attribute Attr

The attribute.

Returns

string