Fauna v10 .NET/C# Driver 1.0.1
 
Loading...
Searching...
No Matches
QueryObj.cs
Go to the documentation of this file.
1using Fauna.Mapping;
3
4namespace Fauna;
5
9public sealed class QueryObj : Query, IQueryFragment
10{
14 public IDictionary<string, Query> Unwrap { get; }
15
20 public QueryObj(IDictionary<string, Query> v)
21 {
22 Unwrap = v;
23 }
24
30 public override void Serialize(MappingContext ctx, Utf8FaunaWriter writer)
31 {
32 var ser = Serializer.Generate(ctx, GetType());
33 ser.Serialize(ctx, writer, this);
34 }
35
41 public override bool Equals(Query? o) => IsEqual(o as QueryObj);
42
48 public override bool Equals(object? o)
49 {
50 return ReferenceEquals(this, o) || IsEqual(o as QueryObj);
51 }
52
57 public override int GetHashCode()
58 {
59 int hash = 31;
60
61 hash *= Unwrap.GetHashCode();
62
63 return hash;
64 }
65
70 public override string ToString() => $"QueryObj({Unwrap})";
71
78 public static bool operator ==(QueryObj left, QueryObj right)
79 {
80 return ReferenceEquals(left, right) || left.Equals(right);
81 }
82
89 public static bool operator !=(QueryObj left, QueryObj right)
90 {
91 return !(left == right);
92 }
93
94 private bool IsEqual(QueryObj? o)
95 {
96 return o is not null && Unwrap.Equals(o.Unwrap);
97 }
98}
A class representing the mapping context to be used during serialization and deserialization.
Represents the abstract base class for constructing FQL queries.
Definition Query.cs:11
Represents a dictionary of FQL queries.
Definition QueryObj.cs:10
override bool Equals(object? o)
Determines whether the specified object is equal to the current QueryObj.
Definition QueryObj.cs:48
override bool Equals(Query? o)
Determines whether the specified QueryObj is equal to the current QueryObj.
static bool operator==(QueryObj left, QueryObj right)
Determines whether two specified instances of QueryObj are equal.
Definition QueryObj.cs:78
override string ToString()
Returns a string that represents the current QueryObj.
static bool operator!=(QueryObj left, QueryObj right)
Determines whether two specified instances of QueryObj are not equal.
Definition QueryObj.cs:89
override int GetHashCode()
The default hash function.
Definition QueryObj.cs:57
override void Serialize(MappingContext ctx, Utf8FaunaWriter writer)
Serializes the query value.
Definition QueryObj.cs:30
QueryObj(IDictionary< string, Query > v)
Initializes a new instance of the QueryObj class with the specified value.
Definition QueryObj.cs:20
IDictionary< string, Query > Unwrap
Gets the value of the specified type represented in the query.
Definition QueryObj.cs:14
Provides functionality for writing data in a streaming manner to a buffer or a stream.
Represents the base interface for a query fragment used for FQL query construction.