Table of Contents

Struct GuidConverter

Namespace
DynaSharp.Serialization
Assembly
DynaSharp.dll

Converts Guid to and from a string value (S) in the lowercase 36-character form, 0f8fad5b-d9cb-469f-a165-70867728950e.

public readonly struct GuidConverter : IDynamoDbConverter<Guid>
Implements
Inherited Members

Remarks

Reading accepts that form in either case, and nothing else: the forms without hyphens or with braces are rejected, so one text means one value. The text is formatted and parsed as UTF-8 on the stack, without creating a string.

Explicit Interface Implementations

Read(ref DynamoDbReader, AttributeType)

Reads the attribute value the reader is positioned on.

static Guid 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

Guid

The value.

Exceptions

JsonException

type is not String.

FormatException

The text is not a Guid in the 36-character form. The message does not quote the text.

Write(DynamoDbWriter, Guid)

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

static void Write(DynamoDbWriter writer, Guid 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 Guid

The value.