Table of Contents

Struct AttributeValueConverter

Namespace
DynaSharp.Serialization
Assembly
DynaSharp.dll

Converts AttributeValue to and from any DynamoDB attribute value: the converter for a property that holds a value of unknown or varying type, and for the values of the untyped API.

public readonly struct AttributeValueConverter : IDynamoDbConverter<AttributeValue>
Implements
Inherited Members

Remarks

Every attribute type is supported, and nested lists and maps are read to any depth DynamoDB allows. Sets read from the wire must have at least one element, which DynamoDB guarantees; an empty set is a JsonException. A map that repeats an attribute name is rejected the same way. A default AttributeValue has no type and cannot be written.

Explicit Interface Implementations

Read(ref DynamoDbReader, AttributeType)

Reads the attribute value the reader is positioned on.

static AttributeValue Read(ref DynamoDbReader reader, AttributeType type)

Parameters

reader DynamoDbReader

The reader, positioned on the value after ReadStartAttribute() or TryReadStartAttribute(out AttributeType). The caller reads the closing brace afterwards, so the converter must read the value completely (all elements of a list, map or set) and nothing more.

type AttributeType

The DynamoDB type of the value. Check it with Expect(AttributeType, AttributeType), which throws JsonException for types the converter does not support. Null is passed to the converter too, so it can map it to null where that makes sense.

Returns

AttributeValue

The value.

Exceptions

JsonException

The value is malformed, for example an empty set or a map that repeats an attribute name.

ArgumentOutOfRangeException

type is not a DynamoDB attribute type, such as None.

Write(DynamoDbWriter, AttributeValue)

Writes a value as one complete attribute value, for example with WriteNumber<T>(T).

static void Write(DynamoDbWriter writer, AttributeValue value)

Parameters

writer DynamoDbWriter

The writer, positioned where a value is expected (after an attribute name, or inside a list). It is a ref struct, so it is never null and needs no check.

value AttributeValue

The value.

Exceptions

ArgumentException

value is a default AttributeValue, which has no type.