Struct TimeOnlyConverter
- Namespace
- DynaSharp.Serialization
- Assembly
- DynaSharp.dll
Converts TimeOnly to and from a string value (S) in the form 12:00:00.0000000: 24-hour clock, always seven
fraction digits, so the text orders like the time.
public readonly struct TimeOnlyConverter : IDynamoDbConverter<TimeOnly>
- Implements
- Inherited Members
Remarks
Reading also accepts fewer fraction digits, down to none (12:00:00).
Explicit Interface Implementations
Read(ref DynamoDbReader, AttributeType)
Reads the attribute value the reader is positioned on.
static TimeOnly Read(ref DynamoDbReader reader, AttributeType type)
Parameters
readerDynamoDbReaderThe 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.
typeAttributeTypeThe 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
- TimeOnly
The value.
Exceptions
- JsonException
typeis not String.- FormatException
The text is not a time in the form
HH:mm:ss.fffffff. The message does not quote the text.
Write(DynamoDbWriter, TimeOnly)
Writes a value as one complete attribute value, for example with WriteNumber<T>(T).
static void Write(DynamoDbWriter writer, TimeOnly value)
Parameters
writerDynamoDbWriterThe 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.
valueTimeOnlyThe value.