/
ClickHouseOptions.cs
56 lines (47 loc) · 1.57 KB
/
ClickHouseOptions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
namespace LinqToDB.DataProvider.ClickHouse
{
using Common;
using Common.Internal;
using Data;
/// <param name="BulkCopyType">
/// Default bulk copy mode.
/// Default value: <c><see cref="BulkCopyType.ProviderSpecific"/></c>.
/// </param>
/// <param name="UseStandardCompatibleAggregates">
/// Enables -OrNull combinator for Min, Max, Sum and Avg aggregation functions to support SQL standard-compatible behavior.
/// Default value: <c>false</c>.
/// </param>
public sealed record ClickHouseOptions
(
BulkCopyType BulkCopyType = BulkCopyType.ProviderSpecific,
bool UseStandardCompatibleAggregates = default
// If you add another parameter here, don't forget to update
// ClickHouseOptions copy constructor and CreateID method.
)
: DataProviderOptions<ClickHouseOptions>(BulkCopyType)
{
public ClickHouseOptions() : this(BulkCopyType.ProviderSpecific)
{
}
ClickHouseOptions(ClickHouseOptions original) : base(original)
{
UseStandardCompatibleAggregates = original.UseStandardCompatibleAggregates;
}
protected override IdentifierBuilder CreateID(IdentifierBuilder builder) => builder
.Add(UseStandardCompatibleAggregates)
;
#region IEquatable implementation
public bool Equals(ClickHouseOptions? other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return ((IOptionSet)this).ConfigurationID == ((IOptionSet)other).ConfigurationID;
}
public override int GetHashCode()
{
return ((IOptionSet)this).ConfigurationID;
}
#endregion
}
}