33 public string Summary {
get; init; } =
"";
38 public Dictionary<string, string>
QueryTags {
get; init; } =
new();
43 public QueryStats
Stats {
get; init; }
49 if (json.TryGetProperty(LastSeenTxnFieldName, out var elem))
54 if (json.TryGetProperty(SchemaVersionFieldName, out elem))
59 if (json.TryGetProperty(SummaryFieldName, out elem))
61 Summary = elem.GetString() ??
"";
65 if (json.TryGetProperty(QueryTagsFieldName, out elem))
67 var queryTagsString = elem.GetString();
69 if (!
string.IsNullOrEmpty(queryTagsString))
71 var tagPairs = queryTagsString.Split(
',').Select(tag =>
73 var tokens = tag.Split(
'=');
74 return KeyValuePair.Create(tokens[0], tokens[1]);
77 QueryTags =
new Dictionary<string, string>(tagPairs);
81 if (json.TryGetProperty(StatsFieldName, out elem))
83 Stats = elem.Deserialize<QueryStats>();
99 HttpStatusCode statusCode,
104 var json = JsonSerializer.Deserialize<JsonElement>(body);
106 if (statusCode is >= HttpStatusCode.OK and <= (HttpStatusCode)299)
113 catch (JsonException)
148 var dataText = json.GetProperty(DataFieldName).GetRawText();
153 if (json.TryGetProperty(StaticTypeFieldName, out var elem))
191 public QueryFailure(HttpStatusCode statusCode, JsonElement json) : base(json)
194 if (!json.TryGetProperty(ErrorFieldName, out var elem))
return;
196 var info = elem.Deserialize<
ErrorInfo>();
Represents a failed query response.
string Message
The query failure message.
ConstraintFailure?[] ConstraintFailures
The constraint failures, if any. Only present for the constraint_failure error code.
string ErrorCode
The Fauna error code.
HttpStatusCode StatusCode
The HTTP status code.
object? Abort
The abort object, if any. Only present for the abort error code.
QueryFailure(HttpStatusCode statusCode, JsonElement json)
Initializes a new instance of the QueryFailure class, parsing the provided raw response text to extra...
Represents the response from a query executed.
JsonElement RawJson
The raw JSON of the query response.
QueryStats Stats
Gets the statistics related to the query execution.
long LastSeenTxn
Gets the last transaction seen by this query.
Dictionary< string, string > QueryTags
Gets a dictionary of query tags, providing additional context about the query.
string Summary
Gets a summary of the query execution.
static ? QueryResponse GetFromResponseBody< T >(MappingContext ctx, ISerializer< T > serializer, HttpStatusCode statusCode, string body)
Asynchronously parses the HTTP response message to create a QueryResponse instance.
long SchemaVersion
Gets the schema version.
Represents a successful query response.
QuerySuccess(MappingContext ctx, ISerializer< T > serializer, JsonElement json)
Initializes a new instance of the QuerySuccess<T> class, deserializing the query response into the sp...
string? StaticType
Gets the static type information from the query response, if available.
T Data
Gets the deserialized data from the query response.
A class representing a constraint failure from Fauna.
A class representing the mapping context to be used during serialization and deserialization.
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 .
Contains detailed information about an error in a query response.
A struct representing stats aggregated across queries.
Represents a reader that provides fast, non-cached, forward-only access to serialized data.