Fauna v10 .NET/C# Driver 0.2.0-beta
 
Loading...
Searching...
No Matches
QueryStringHandler.cs
Go to the documentation of this file.
1using System.Runtime.CompilerServices;
2
3namespace Fauna;
4
8[InterpolatedStringHandler]
9public ref struct QueryStringHandler
10{
11 private readonly List<IQueryFragment> _fragments;
12
18 public QueryStringHandler(int literalLength, int formattedCount)
19 {
20 _fragments = new List<IQueryFragment>();
21 }
22
27 public void AppendLiteral(string value)
28 {
29 _fragments.Add(new QueryLiteral(value));
30 }
31
36 public void AppendFormatted(object? value)
37 {
38 if (value is QueryExpr expr)
39 {
40 _fragments.Add(expr);
41 }
42 else
43 {
44 _fragments.Add(new QueryVal(value));
45 }
46 }
47
52 public Query Result()
53 {
54 return new QueryExpr(_fragments);
55 }
56}
Represents an FQL query expression. This class encapsulates a list of IQueryFragment instances,...
Definition QueryExpr.cs:11
Represents the abstract base class for constructing FQL queries.
Definition Query.cs:11
Represents a literal part of an FQL query. This class is used for embedding raw string values directl...
Represents a generic value holder for FQL queries. This class allows embedding values of various type...
Definition QueryVal.cs:10
Definition Client.cs:8
Provides a mechanism to build FQL query expressions using interpolated strings. This structure collec...
Query Result()
Constructs and returns a Query instance representing the current state of the handler.
void AppendLiteral(string value)
Appends a literal string to the query.
void AppendFormatted(object? value)
Appends a formatted value to the query. The value is wrapped as a QueryVal or QueryExpr depending on ...
QueryStringHandler(int literalLength, int formattedCount)
Initializes a new instance of the QueryStringHandler struct.