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