Fauna v10 .NET/C# Driver 1.0.0
 
Loading...
Searching...
No Matches
QueryValSerializer.cs
Go to the documentation of this file.
1using System.Diagnostics;
3using Fauna.Mapping;
4
5namespace Fauna.Serialization;
6
7
8internal class QueryValSerializer : BaseSerializer<QueryObj>
9{
10 public override QueryObj Deserialize(MappingContext ctx, ref Utf8FaunaReader reader) =>
11 throw new NotImplementedException();
12
13 public override void Serialize(MappingContext context, Utf8FaunaWriter writer, object? obj)
14 {
15 switch (obj)
16 {
17 case null:
18 writer.WriteNullValue();
19 break;
20 case QueryVal v:
21 writer.WriteStartObject();
22 writer.WriteFieldName("value");
23 var ser = v.Unwrap is not null ? Serializer.Generate(context, v.Unwrap.GetType()) : DynamicSerializer.Singleton;
24 ser.Serialize(context, writer, v.Unwrap);
25 writer.WriteEndObject();
26 break;
27 default:
29 }
30 }
31}
Represents error that occur during serialization and deserialization of Fauna data.
A class representing the mapping context to be used during serialization and deserialization.
Represents a dictionary of FQL queries.
Definition QueryObj.cs:10
Represents a generic value holder for FQL queries. This class allows embedding values of various type...
Definition QueryVal.cs:10
override void Serialize(MappingContext ctx, Utf8FaunaWriter writer)
Serializes the query value.
Definition QueryVal.cs:31
string UnsupportedSerializationTypeMessage(Type type)
A helper to build an unsupported serialization type exception message.
object? ISerializer. Deserialize(MappingContext ctx, ref Utf8FaunaReader reader)
Consumes or partially consumes the provided reader and deserializes into a result.
void ISerializer. Serialize(MappingContext context, Utf8FaunaWriter writer, object? o)
Serializes the provided object onto the Utf8FaunaWriter