10 private Func<I, O> _mapper;
18 public override List<FaunaType> GetSupportedTypes() => _inner.
GetSupportedTypes();
21 _mapper(_inner.Deserialize(ctx, ref reader));
25 throw new NotImplementedException();
33 public ProjectionDeserializer(IEnumerable<ISerializer> fields)
35 _fields = fields.ToArray();
38 public override List<FaunaType> GetSupportedTypes() => _fields.SelectMany(x => x.GetSupportedTypes()).Distinct().ToList();
42 if (reader.CurrentTokenType !=
TokenType.StartArray)
43 throw UnexpectedToken(reader.CurrentTokenType);
45 var values =
new object?[_fields.Length];
47 for (var i = 0; i < _fields.Length; i++)
50 if (reader.CurrentTokenType ==
TokenType.EndArray)
throw UnexpectedToken(reader.CurrentTokenType);
52 values[i] = _fields[i].
Deserialize(ctx, ref reader);
56 if (reader.CurrentTokenType !=
TokenType.EndArray)
throw UnexpectedToken(reader.CurrentTokenType);
63 throw new NotImplementedException();
67 new($
"Unexpected token while deserializing LINQ element: {tokenType}");
Represents error that occur during serialization and deserialization of Fauna data.
A class representing the mapping context to be used during serialization and deserialization.
An abstract class encapsulating common serialization and deserialization logic.
Provides functionality for writing data in a streaming manner to a buffer or a stream.
A generic interface that defines serialize and deserialize behavior for a specific type,...
new T Deserialize(MappingContext ctx, ref Utf8FaunaReader reader)
Consumes all or some of a Utf8FaunaReader and returns an instance of T .
List< FaunaType > GetSupportedTypes()
A list of types to which the ISerializer applies.
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
TokenType
Enumerates the types of tokens used in Fauna serialization.
Represents a reader that provides fast, non-cached, forward-only access to serialized data.