Fauna v10 .NET/C# Driver 1.0.1
 
Loading...
Searching...
No Matches
QueryOptions.cs
Go to the documentation of this file.
1namespace Fauna.Core;
2
6public class QueryOptions
7{
11 public bool? Linearized { get; set; } = null;
12
16 public bool? TypeCheck { get; set; } = null;
17
22 public TimeSpan QueryTimeout { get; set; } = TimeSpan.FromSeconds(5);
23
28 public Dictionary<string, string>? QueryTags { get; set; } = null;
29
33 public string? TraceParent { get; set; } = null;
34
41 internal static QueryOptions GetFinalQueryOptions(QueryOptions options, QueryOptions? overrides)
42 {
43 if (overrides == null)
44 {
45 return options;
46 }
47
48 var finalQueryOptions = new QueryOptions()
49 {
50 Linearized = options.Linearized,
51 TypeCheck = options.TypeCheck,
52 QueryTimeout = options.QueryTimeout,
53 QueryTags = options.QueryTags,
54 TraceParent = options.TraceParent,
55 };
56
57 var properties = typeof(QueryOptions).GetProperties();
58
59 foreach (var prop in properties)
60 {
61 if (prop.Name.Equals(nameof(QueryTags)))
62 {
63 continue;
64 }
65
66 var propertyOverride = prop.GetValue(overrides);
67
68 if (propertyOverride != null)
69 {
70 prop.SetValue(finalQueryOptions, propertyOverride);
71 }
72 }
73
74 if (overrides.QueryTags != null)
75 {
76 if (finalQueryOptions.QueryTags == null)
77 {
78 finalQueryOptions.QueryTags = overrides.QueryTags;
79 }
80 else
81 {
82 foreach (var kv in overrides.QueryTags)
83 {
84 if (finalQueryOptions.QueryTags.ContainsKey(kv.Key))
85 {
86 finalQueryOptions.QueryTags[kv.Key] = kv.Value;
87 }
88 else
89 {
90 finalQueryOptions.QueryTags.Add(kv.Key, kv.Value);
91 }
92 }
93 }
94 }
95
96 return finalQueryOptions;
97 }
98}
Represents the options for customizing Fauna queries.
bool? TypeCheck
Gets or sets a value indicating whether type checking of the query is enabled or disabled before eval...
Dictionary< string, string >? QueryTags
Gets or sets a string-encoded set of caller-defined tags for identifying the request in logs and resp...
TimeSpan QueryTimeout
Gets or sets the query timeout. It defines how long the client waits for a query to complete....
string? TraceParent
Gets or sets the trace parent identifier for distributed tracing systems.
bool? Linearized
Gets or sets a value indicating whether the query runs as strictly serialized, affecting read-only tr...