Fauna v10 .NET/C# Driver 1.0.1
 
Loading...
Searching...
No Matches
QueryLiteral.cs
Go to the documentation of this file.
1using Fauna.Mapping;
3
4namespace Fauna;
5
9public sealed class QueryLiteral : IQueryFragment
10{
16 public QueryLiteral(string v)
17 {
18 if (v == null)
19 {
20 throw new ArgumentNullException(nameof(v), "Value cannot be null.");
21 }
22
23 Unwrap = v;
24 }
25
29 public string Unwrap { get; }
30
35 public override string ToString()
36 {
37 return $"QueryLiteral({Unwrap})";
38 }
39
45 public void Serialize(MappingContext ctx, Utf8FaunaWriter writer)
46 {
48 }
49
55 public override bool Equals(object? other)
56 {
57 var otherQuery = other as IQueryFragment;
58
59 if (otherQuery is null)
60 {
61 return false;
62 }
63
64 if (ReferenceEquals(this, otherQuery))
65 {
66 return true;
67 }
68
69 if (otherQuery is QueryLiteral otherLiteral)
70 {
71 return Unwrap == otherLiteral.Unwrap;
72 }
73
74 return false;
75 }
76
81 public override int GetHashCode()
82 {
83 return Unwrap.GetHashCode();
84 }
85
92 public static bool operator ==(QueryLiteral left, QueryLiteral right)
93 {
94 return Equals(left, right);
95 }
96
103 public static bool operator !=(QueryLiteral left, QueryLiteral right)
104 {
105 return !Equals(left, right);
106 }
107}
A class representing the mapping context to be used during serialization and deserialization.
Represents a literal part of an FQL query. This class is used for embedding raw string values directl...
override bool Equals(object? other)
Determines whether the specified object is equal to the current QueryLiteral.
override int GetHashCode()
The default hash function.
QueryLiteral(string v)
Initializes a new instance of the QueryLiteral class with the specified value.
static bool operator==(QueryLiteral left, QueryLiteral right)
Determines whether two specified instances of QueryLiteral are equal.
string Unwrap
Gets the string value of the query literal.
static bool operator!=(QueryLiteral left, QueryLiteral right)
Determines whether two specified instances of QueryLiteral are not equal.
void Serialize(MappingContext ctx, Utf8FaunaWriter writer)
Serializes the query literal.
override string ToString()
Returns a string that represents the current QueryLiteral.
Provides functionality for writing data in a streaming manner to a buffer or a stream.
void WriteStringValue(string value)
Writes a string value as a tagged element.
Represents the base interface for a query fragment used for FQL query construction.