From c72ce9216a617deb00e22fe2136ced70c59cf13b Mon Sep 17 00:00:00 2001 From: Denis Ivanov Date: Thu, 25 Dec 2025 23:10:15 +0200 Subject: [PATCH 1/3] Add `divideDecimal` translation --- ...ickHouseArithmeticDbFunctionsExtensions.cs | 37 +- .../ClickHouseBoolDbFunctionsExtensions.cs | 40 +- .../ClickHouseDate32DbFunctionsExtensions.cs | 180 ++- .../ClickHouseDateDbFunctionsExtensions.cs | 284 ++-- ...ickHouseDateTime64DbFunctionsExtensions.cs | 1344 ++++++++--------- ...ClickHouseDateTimeDbFunctionsExtensions.cs | 321 ++-- ...ickHouseDecimal128DbFunctionsExtensions.cs | 130 +- ...ickHouseDecimal256DbFunctionsExtensions.cs | 159 +- ...lickHouseDecimal32DbFunctionsExtensions.cs | 140 +- ...lickHouseDecimal64DbFunctionsExtensions.cs | 130 +- .../ClickHouseFloat32DbFunctionsExtensions.cs | 176 ++- .../ClickHouseFloat64DbFunctionsExtensions.cs | 174 ++- .../ClickHouseInt128DbFunctionsExtensions.cs | 138 +- .../ClickHouseInt16DbFunctionsExtensions.cs | 134 +- .../ClickHouseInt32DbFunctionsExtensions.cs | 140 +- .../ClickHouseInt64DbFunctionsExtensions.cs | 140 +- .../ClickHouseInt8DbFunctionsExtensions.cs | 138 +- .../ClickHouseUInt128DbFunctionsExtensions.cs | 140 +- .../ClickHouseUInt16DbFunctionsExtensions.cs | 140 +- .../ClickHouseUInt32DbFunctionsExtensions.cs | 140 +- .../ClickHouseUInt64DbFunctionsExtensions.cs | 140 +- .../ClickHouseUInt8DbFunctionsExtensions.cs | 140 +- .../ClickHouseUuidDbFunctionsExtensions.cs | 131 +- .../Query/ClickHouseSqlExpressionFactory.cs | 22 + .../ClickHouseDecimal256MethodTranslator.cs | 4 + .../ClickHouseDecimal32MethodTranslator.cs | 2 +- .../Internal/ClickHouseMathTranslator.cs | 23 +- ...ouseDecimal256DbFunctionsExtensionsTest.cs | 12 + 28 files changed, 2350 insertions(+), 2349 deletions(-) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs index 879b0d0..2e4356d 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs @@ -6,24 +6,27 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseArithmeticDbFunctionsExtensions { - /// - /// Calculates the quotient of two values x and y. - /// The result type is always double. - /// Integer division is provided by the intDiv function. - /// /// DbFunctions instance. - /// Dividend. - /// Divisor - /// - /// - /// The quotient of x and y. - /// - /// Division by 0 returns double.PositiveInfinity, double.NegativeInfinity, or double.NaN. - /// - public static double Divide(this DbFunctions _, TDividend x, TDivisor y) - where TDividend : INumber - where TDivisor: INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); + /// + /// Calculates the quotient of two values x and y. + /// The result type is always double. + /// Integer division is provided by the intDiv function. + /// + /// Dividend. + /// Divisor + /// + /// + /// The quotient of x and y. + /// + /// Division by 0 returns double.PositiveInfinity, double.NegativeInfinity, or double.NaN. + /// + public double Divide(TDividend x, TDivisor y) + where TDividend : INumber + where TDivisor: INumber + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs index 50eea5a..913a9f8 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs @@ -6,27 +6,29 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseBoolDbFunctionsExtensions { - /// - /// Converts an input value to a value of type Bool. Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string. - /// Returns true or false based on evaluation of the argument. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tobool - public static bool ToBool(this DbFunctions _, string expr) + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Bool. Throws an exception in case of an error. + /// + /// Expression returning a number or a string. + /// Returns true or false based on evaluation of the argument. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tobool + public bool ToBool(string expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Bool. Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string. - /// Returns true or false based on evaluation of the argument. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tobool - public static bool ToBool(this DbFunctions _, TNumber expr) where TNumber: INumber - { - throw new InvalidOperationException(); + /// + /// Converts an input value to a value of type Bool. Throws an exception in case of an error. + /// + /// Expression returning a number or a string. + /// Returns true or false based on evaluation of the argument. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tobool + public bool ToBool(TNumber expr) where TNumber: INumber + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs index 21d7088..b87da79 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs @@ -5,102 +5,100 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDate32DbFunctionsExtensions { - /// - /// Converts the argument to the Date32 data type. If the value is outside the range, - /// toDate32 returns the border values supported by Date32. If the argument is of type Date, it's bounds are taken into - /// /// DbFunctions instance. - /// The value to convert. - /// Returns a calendar date. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate32 - public static DateOnly ToDate32(this DbFunctions _, string? expr) + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts the argument to the Date32 data type. If the value is outside the range, + /// toDate32 returns the border values supported by Date32. If the argument is of type Date, it's bounds are taken into + /// + /// The value to convert. + /// Returns a calendar date. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate32 + public DateOnly ToDate32(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts the argument to the Date32 data type. If the value is outside the range, - /// toDate32 returns the border values supported by Date32. If the argument is of type Date, it's bounds are taken into - /// - /// DbFunctions instance. - /// The value to convert. - /// Returns a calendar date. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate32 - public static DateOnly ToDate32(this DbFunctions _, uint expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts the argument to the Date32 data type. If the value is outside the range, + /// toDate32 returns the border values supported by Date32. If the argument is of type Date, it's bounds are taken into + /// + /// The value to convert. + /// Returns a calendar date. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate32 + public DateOnly ToDate32(uint expr) + { + throw new InvalidOperationException(); + } - /// - /// The same as but returns the min value of Date32 if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value to convert. - /// Returns a calendar date. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32orzero - public static DateOnly ToDate32OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// The same as but returns the min value of Date32 if an invalid argument is received. + /// + /// The value to convert. + /// Returns a calendar date. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32orzero + public DateOnly ToDate32OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// The same as but returns null if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value to convert. - /// - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ornull - public static DateOnly? ToDate32OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } - - /// - /// Converts the argument to the Date32 data type. - /// If the value is outside the range, toDate32OrDefault returns the lower border value supported by Date32. - /// If the argument has Date type, it's borders are taken into account. - /// Returns default value if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value to convert. - /// Returns a calendar date. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ordefault - public static DateOnly ToDate32OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// The same as but returns null if an invalid argument is received. + /// + /// The value to convert. + /// + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ornull + public DateOnly? ToDate32OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts the argument to the Date32 data type. - /// If the value is outside the range, toDate32OrDefault returns the lower border value supported by Date32. - /// If the argument has Date type, it's borders are taken into account. - /// Returns default value if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value to convert. - /// - /// Returns a calendar date. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ordefault - public static DateOnly ToDate32OrDefault(this DbFunctions _, string? expr, DateOnly defaultValue) - { - throw new InvalidOperationException(); + /// + /// Converts the argument to the Date32 data type. + /// If the value is outside the range, toDate32OrDefault returns the lower border value supported by Date32. + /// If the argument has Date type, it's borders are taken into account. + /// Returns default value if an invalid argument is received. + /// + /// The value to convert. + /// Returns a calendar date. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ordefault + public DateOnly ToDate32OrDefault(string? expr) + { + throw new InvalidOperationException(); + } + + /// + /// Converts the argument to the Date32 data type. + /// If the value is outside the range, toDate32OrDefault returns the lower border value supported by Date32. + /// If the argument has Date type, it's borders are taken into account. + /// Returns default value if an invalid argument is received. + /// + /// The value to convert. + /// + /// Returns a calendar date. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ordefault + public DateOnly ToDate32OrDefault(string? expr, DateOnly defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs index 2861729..fc0200b 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs @@ -6,161 +6,155 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDateDbFunctionsExtensions { - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// /// DbFunctions instance. - /// Input value to convert. - /// - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public static DateOnly ToDate(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public DateOnly ToDate(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// DbFunctions instance. - /// Input value to convert. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public static DateOnly ToDate(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public DateOnly ToDate(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// DbFunctions instance. - /// Input value to convert. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public static DateOnly ToDate(this DbFunctions _, DateTime expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public DateOnly ToDate(DateTime expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// DbFunctions instance. - /// Input value to convert. - /// Time zone of the specified Date object. - /// - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public static DateOnly ToDate(this DbFunctions _, TNumber expr, string timeZone) where TNumber : INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// Time zone of the specified Date object. + /// + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public DateOnly ToDate(TNumber expr, string timeZone) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// DbFunctions instance. - /// Input value to convert. - /// Time zone of the specified Date object. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public static DateOnly ToDate(this DbFunctions _, string? expr, string timeZone) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// Time zone of the specified Date object. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public DateOnly ToDate(string? expr, string timeZone) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// DbFunctions instance. - /// Input value to convert. - /// Time zone of the specified Date object. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public static DateOnly ToDate(this DbFunctions _, DateTime expr, string timeZone) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// Time zone of the specified Date object. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public DateOnly ToDate(DateTime expr, string timeZone) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Date but returns the lower boundary of Date if an invalid argument - /// is received. The same as toDate but returns lower boundary of Date if an invalid argument is received. - /// - /// DbFunctions instance. - /// A string representation of a date. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateOrZero - public static DateOnly ToDateOrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Date but returns the lower boundary of Date if an invalid argument + /// is received. The same as toDate but returns lower boundary of Date if an invalid argument is received. + /// + /// A string representation of a date. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateOrZero + public DateOnly ToDateOrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Date but returns null if an invalid argument is received. - /// The same as toDate but returns null if an invalid argument is received. - /// - /// DbFunctions instance. - /// A string representation of a date. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateOrNull - public static DateOnly? ToDateOrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Date but returns null if an invalid argument is received. + /// The same as toDate but returns null if an invalid argument is received. + /// + /// A string representation of a date. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateOrNull + public DateOnly? ToDateOrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like but if unsuccessful, returns a default value which is either - /// the second argument (if specified), or otherwise the lower boundary of Date. - /// - /// DbFunctions instance. - /// A string representation of a date. - /// Value of type Date if successful, otherwise returns the default value if passed or 1970-01-01 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateOnly ToDateOrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like but if unsuccessful, returns a default value which is either + /// the second argument (if specified), or otherwise the lower boundary of Date. + /// + /// A string representation of a date. + /// Value of type Date if successful, otherwise returns the default value if passed or 1970-01-01 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateOnly ToDateOrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like but if unsuccessful, returns a default value which is either - /// the second argument (if specified), or otherwise the lower boundary of Date. - /// - /// DbFunctions instance. - /// A string representation of a date. - /// The default value to return if parsing is unsuccessful. - /// Value of type Date if successful, otherwise returns the default value if passed or 1970-01-01 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateOnly ToDateOrDefault(this DbFunctions _, string? expr, DateOnly defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like but if unsuccessful, returns a default value which is either + /// the second argument (if specified), or otherwise the lower boundary of Date. + /// + /// A string representation of a date. + /// The default value to return if parsing is unsuccessful. + /// Value of type Date if successful, otherwise returns the default value if passed or 1970-01-01 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateOnly ToDateOrDefault(string? expr, DateOnly defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs index b8a691b..242fc3f 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs @@ -6,696 +6,660 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDateTime64DbFunctionsExtensions { - /// - /// Converts an input value to a value of type DateTime64. - /// /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64(this DbFunctions _, string expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified datetime64 object. - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64(this DbFunctions _, string expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64(this DbFunctions _, uint expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified datetime64 object. - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64(this DbFunctions _, DateOnly expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified datetime64 object. - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64(this DbFunctions _, DateOnly expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64(this DbFunctions _, float expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified datetime64 object. - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64(this DbFunctions _, float expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64OrZero(this DbFunctions _, string expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified datetime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64OrZero(this DbFunctions _, string expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64OrZero(this DbFunctions _, uint expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64OrZero(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64OrZero(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64OrZero(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public static DateTime? ToDateTime64OrNull(this DbFunctions _, string expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public static DateTime? ToDateTime64OrNull(this DbFunctions _, string expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public static DateTime? ToDateTime64OrNull(this DbFunctions _, uint expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public static DateTime? ToDateTime64OrNull(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public static DateTime? ToDateTime64OrNull(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public static DateTime? ToDateTime64OrNull(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public static DateTime? ToDateTime64OrNull(this DbFunctions _, float expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static DateTime? ToDateTime64OrNull(this DbFunctions _, float expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime? ToDateTime64OrDefault(this DbFunctions _, string expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, string expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime? ToDateTime64OrDefault(this DbFunctions _, string expr, [Range(0, 9)] byte scale, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, string expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Range(0, 9)] byte scale, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) - { - throw new InvalidOperationException(); + extension(DbFunctions _) + { + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64(string expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified datetime64 object. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64(string expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64(uint expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified datetime64 object. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64(uint expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64(DateOnly expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified datetime64 object. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64(DateOnly expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64(float expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified datetime64 object. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64(float expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64OrZero(string expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified datetime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64OrZero(string expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64OrZero(uint expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64OrZero(uint expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64OrZero(DateTime expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64OrZero(DateTime expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64OrZero(float expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime ToDateTime64OrZero(float expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public DateTime? ToDateTime64OrNull(string expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public DateTime? ToDateTime64OrNull(string expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public DateTime? ToDateTime64OrNull(uint expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public DateTime? ToDateTime64OrNull(uint expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public DateTime? ToDateTime64OrNull(DateTime expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public DateTime? ToDateTime64OrNull(DateTime expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public DateTime? ToDateTime64OrNull(float expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public DateTime? ToDateTime64OrNull(float expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime? ToDateTime64OrDefault(string expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(string expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(uint expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(uint expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(DateTime expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(DateTime expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(float expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(float expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Default value to return if an invalid argument is received. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime? ToDateTime64OrDefault(string expr, [Range(0, 9)] byte scale, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// Default value to return if an invalid argument is received. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(string expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Default value to return if an invalid argument is received. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(uint expr, [Range(0, 9)] byte scale, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// Default value to return if an invalid argument is received. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(uint expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Default value to return if an invalid argument is received. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(DateTime expr, [Range(0, 9)] byte scale, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// Default value to return if an invalid argument is received. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(DateTime expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Default value to return if an invalid argument is received. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(float expr, [Range(0, 9)] byte scale, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// Default value to return if an invalid argument is received. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public DateTime ToDateTime64OrDefault(float expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs index 12d1c1e..cf72c4e 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs @@ -6,181 +6,174 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDateTimeDbFunctionsExtensions { - /// - /// Converts an input value to type DateTime. - /// /// DbFunctions instance. - /// The value. - /// - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public static DateTime ToDateTime(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public DateTime ToDateTime(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type DateTime. - /// - /// DbFunctions instance. - /// The value. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public static DateTime ToDateTime(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public DateTime ToDateTime(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type DateTime. - /// - /// DbFunctions instance. - /// The value. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public static DateTime ToDateTime(this DbFunctions _, DateOnly expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public DateTime ToDateTime(DateOnly expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type DateTime. - /// - /// DbFunctions instance. - /// The value. - /// Time zone. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public static DateTime ToDateTime(this DbFunctions _, TNumber expr, string timeZone) where TNumber : INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// Time zone. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public DateTime ToDateTime(TNumber expr, string timeZone) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type DateTime. - /// - /// DbFunctions instance. - /// The value. - /// Time zone. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public static DateTime ToDateTime(this DbFunctions _, string? expr, string timeZone) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// Time zone. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public DateTime ToDateTime(string? expr, string timeZone) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type DateTime. - /// - /// DbFunctions instance. - /// The value. - /// Time zone. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public static DateTime ToDateTime(this DbFunctions _, DateOnly expr, string timeZone) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// Time zone. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public DateTime ToDateTime(DateOnly expr, string timeZone) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type DateTime but returns the lower boundary of DateTime - /// if an invalid argument is received. - /// The same as toDateTime but returns lower boundary of DateTime if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrZero - public static DateTime ToDateTimeOrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type DateTime but returns the lower boundary of DateTime + /// if an invalid argument is received. + /// The same as toDateTime but returns lower boundary of DateTime if an invalid argument is received. + /// + /// The value. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrZero + public DateTime ToDateTimeOrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type DateTime but returns null if an invalid argument is received. - /// The same as but returns if an invalid argument is received. - /// - /// DbFunctions instance. - /// The value. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrNull - public static DateTime? ToDateTimeOrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type DateTime but returns null if an invalid argument is received. + /// The same as but returns if an invalid argument is received. + /// + /// The value. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrNull + public DateTime? ToDateTimeOrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), - /// or otherwise the lower boundary of DateTime. - /// - /// DbFunctions instance. - /// The value. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault - public static DateTime ToDateTimeOrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), + /// or otherwise the lower boundary of DateTime. + /// + /// The value. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault + public DateTime ToDateTimeOrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), - /// or otherwise the lower boundary of DateTime. - /// - /// DbFunctions instance. - /// The value. - /// Time zone. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault - public static DateTime ToDateTimeOrDefault(this DbFunctions _, string? expr, string timeZone) - { - throw new InvalidOperationException(); - } + /// + /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), + /// or otherwise the lower boundary of DateTime. + /// + /// The value. + /// Time zone. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault + public DateTime ToDateTimeOrDefault(string? expr, string timeZone) + { + throw new InvalidOperationException(); + } - /// - /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), - /// or otherwise the lower boundary of DateTime. - /// - /// DbFunctions instance. - /// The value. - /// Time zone. - /// The default value to return if parsing is unsuccessful. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault - public static DateTime ToDateTimeOrDefault(this DbFunctions _, string? expr, string timeZone, DateTime defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), + /// or otherwise the lower boundary of DateTime. + /// + /// The value. + /// Time zone. + /// The default value to return if parsing is unsuccessful. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault + public DateTime ToDateTimeOrDefault(string? expr, string timeZone, DateTime defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs index 8997e72..c36b8c8 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs @@ -7,78 +7,76 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDecimal128DbFunctionsExtensions { - /// - /// Converts an input value to a value of type Decimal(38, S) with scale of S. Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal128(this DbFunctions _, string number, [Range(0, 38)] byte scale) + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(38, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal128(string number, [Range(0, 38)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Decimal(38, S) with scale of S. Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal128(this DbFunctions _, TNumber number, [Range(0, 38)] byte scale) where TNumber : INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(38, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal128(TNumber number, [Range(0, 38)] byte scale) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(38, S) but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal128OrZero(this DbFunctions _, string? number, [Range(0, 38)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(38, S) but returns 0 in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal128OrZero(string? number, [Range(0, 38)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// Nullable(Decimal(38, S)) but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - /// - public static decimal? ToDecimal128OrNull(this DbFunctions _, string? number, [Range(0, 38)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// Nullable(Decimal(38, S)) but returns null in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// + /// + public decimal? ToDecimal128OrNull(string? number, [Range(0, 38)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(38, S) but returns the default value in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal128OrDefault(this DbFunctions _, string? number, [Range(0, 38)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(38, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal128OrDefault(string? number, [Range(0, 38)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(38, S) but returns the default value in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - /// - public static decimal ToDecimal128OrDefault(this DbFunctions _, string? number, [Range(0, 38)] byte scale, decimal defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type Decimal(38, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// + /// + public decimal ToDecimal128OrDefault(string? number, [Range(0, 38)] byte scale, decimal defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs index 6d7b189..9bb88bf 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs @@ -7,77 +7,106 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDecimal256DbFunctionsExtensions { - /// - /// Converts an input value to a value of type Decimal(76, S) with scale of S. Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal256(this DbFunctions _, string number, [Range(0, 76)] byte scale) + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(76, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal256(string number, [Range(0, 76)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Decimal(76, S) with scale of S. Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal256(this DbFunctions _, TNumber number, [Range(0, 76)] byte scale) where TNumber : INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(76, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal256(TNumber number, [Range(0, 76)] byte scale) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(76, S) but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// - /// - public static decimal ToDecimal256OrZero(this DbFunctions _, string? number, [Range(0, 76)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(76, S) but returns 0 in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// + /// + public decimal ToDecimal256OrZero(string? number, [Range(0, 76)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Nullable(Decimal(76, S)) but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// - public static decimal? ToDecimal256OrNull(this DbFunctions _, string? number, [Range(0, 76)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Nullable(Decimal(76, S)) but returns null in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// + public decimal? ToDecimal256OrNull(string? number, [Range(0, 76)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(76, S) but returns the default value in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// - public static decimal? ToDecimal256OrDefault(this DbFunctions _, string? number, [Range(0, 76)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(76, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// + public decimal? ToDecimal256OrDefault(string? number, [Range(0, 76)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(76, S) but returns the default value in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// The default value to return if parsing to type Decimal256(S) is unsuccessful. - /// - public static decimal? ToDecimal256OrDefault(this DbFunctions _, string? number, [Range(0, 76)] byte scale, decimal defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type Decimal(76, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// The default value to return if parsing to type Decimal256(S) is unsuccessful. + /// + public decimal? ToDecimal256OrDefault(string? number, [Range(0, 76)] byte scale, decimal defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Performs division on two decimals. Result value will be of type Decimal256. + /// + /// First value. + /// Second value. + /// + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/arithmetic-functions#divideDecimal + public decimal DivideDecimal(decimal x, decimal y) + { + throw new InvalidOperationException(); + } + + /// + /// Performs division on two decimals. Result value will be of type Decimal256. + /// + /// First value. + /// Second value. + /// Scale of result. + /// + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/arithmetic-functions#divideDecimal + public decimal DivideDecimal(decimal x, decimal y, [Range(0, 76)] byte scale) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal32DbFunctionsExtensions.cs index 6b49c13..c973b02 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal32DbFunctionsExtensions.cs @@ -7,83 +7,81 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDecimal32DbFunctionsExtensions { - /// - /// Converts an input value to a value of type Decimal(9, S) with scale of S. - /// Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal32(this DbFunctions _, string number, [Range(0, 9)] byte scale) + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(9, S) with scale of S. + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal32(string number, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Decimal(9, S) with scale of S. - /// Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal32(this DbFunctions _, TNumber number, [Range(0, 9)] byte scale) where TNumber: INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(9, S) with scale of S. + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal32(TNumber number, [Range(0, 9)] byte scale) where TNumber: INumber + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(9, S) - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal32OrZero(this DbFunctions _, string? number, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(9, S) + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal32OrZero(string? number, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(9, S) - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - public static decimal? ToDecimal32OrNull(this DbFunctions _, string? number, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(9, S) + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// + public decimal? ToDecimal32OrNull(string? number, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(9, S) - /// but returns the default value in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - /// - public static decimal ToDecimal32OrDefault(this DbFunctions _, string? number, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(9, S) + /// but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// + /// + public decimal ToDecimal32OrDefault(string? number, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(9, S) - /// but returns the default value in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - /// - public static decimal ToDecimal32OrDefault(this DbFunctions _, string? number, [Range(0, 9)] byte scale, decimal defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type Decimal(9, S) + /// but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// + /// + public decimal ToDecimal32OrDefault(string? number, [Range(0, 9)] byte scale, decimal defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs index b692771..b70951a 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs @@ -7,78 +7,76 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDecimal64DbFunctionsExtensions { - /// - /// Converts an input value to a value of type Decimal(18, S) with scale of S. Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal64(this DbFunctions _, string number, [Range(0, 18)] byte scale) + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(18, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal64(string number, [Range(0, 18)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Decimal(18, S) with scale of S. Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal64(this DbFunctions _, TNumber number, [Range(0, 18)] byte scale) where TNumber : INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(18, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal64(TNumber number, [Range(0, 18)] byte scale) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(18, S) - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal64OrZero(this DbFunctions _, string? number, [Range(0, 18)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(18, S) + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal64OrZero(string? number, [Range(0, 18)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Nullable(Decimal(18, S)) - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - public static decimal? ToDecimal64OrNull(this DbFunctions _, string? number, [Range(0, 18)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Nullable(Decimal(18, S)) + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// + public decimal? ToDecimal64OrNull(string? number, [Range(0, 18)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(18, S) but returns the default value in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - public static decimal ToDecimal64OrDefault(this DbFunctions _, string? number, [Range(0, 18)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(18, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// + public decimal ToDecimal64OrDefault(string? number, [Range(0, 18)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(18, S) but returns the default value in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - /// - public static decimal ToDecimal64OrDefault(this DbFunctions _, string? number, [Range(0, 18)] byte scale, decimal defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type Decimal(18, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// + /// + public decimal ToDecimal64OrDefault(string? number, [Range(0, 18)] byte scale, decimal defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs index 924eeb8..420a8f1 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs @@ -6,101 +6,99 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseFloat32DbFunctionsExtensions { - /// - /// Converts an input value to a value of type Float32. Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// 32-bit floating point value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32 - public static float ToFloat32(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Float32. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// 32-bit floating point value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32 + public float ToFloat32(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Float32. Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// 32-bit floating point value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32 - public static float ToFloat32(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Float32. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// 32-bit floating point value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32 + public float ToFloat32(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value - /// of type Float32 but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// 32-bit Float value if successful, otherwise 0. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32orzero - public static float ToFloat32OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value + /// of type Float32 but returns 0 in case of an error. + /// + /// A String representation of a number. + /// 32-bit Float value if successful, otherwise 0. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32orzero + public float ToFloat32OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value - /// of type Float32 but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// 32-bit Float value if successful, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ornull - public static float? ToFloat32OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value + /// of type Float32 but returns null in case of an error. + /// + /// A String representation of a number. + /// 32-bit Float value if successful, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ornull + public float? ToFloat32OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Float32 - /// but returns the default value in case of an error. If no default value is passed - /// then 0 is returned in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// 32-bit Float value if successful, otherwise returns the default value if passed or 0 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ordefault - public static float ToFloat32OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Float32 + /// but returns the default value in case of an error. If no default value is passed + /// then 0 is returned in case of an error. + /// + /// A String representation of a number. + /// 32-bit Float value if successful, otherwise returns the default value if passed or 0 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ordefault + public float ToFloat32OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Float32 - /// but returns the default value in case of an error. If no default value is passed - /// then 0 is returned in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// The default value to return if parsing to type Float32 is unsuccessful. - /// 32-bit Float value if successful, otherwise returns the default value if passed or 0 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ordefault - public static float ToFloat32OrDefault(this DbFunctions _, string? expr, float defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type Float32 + /// but returns the default value in case of an error. If no default value is passed + /// then 0 is returned in case of an error. + /// + /// A String representation of a number. + /// The default value to return if parsing to type Float32 is unsuccessful. + /// 32-bit Float value if successful, otherwise returns the default value if passed or 0 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ordefault + public float ToFloat32OrDefault(string? expr, float defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs index 6dfd5a3..6d330a8 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs @@ -6,100 +6,98 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseFloat64DbFunctionsExtensions { - /// - /// Converts an input value to a value of type Float64. Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// Returns a 64-bit floating point value. - /// - /// is used for converting string representations of numbers to Float64. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64 - public static double ToFloat64(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Float64. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// Returns a 64-bit floating point value. + /// + /// is used for converting string representations of numbers to Float64. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64 + public double ToFloat64(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Float64. Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Returns a 64-bit floating point value. - /// - /// is used for converting string representations of numbers to Float64. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64 - public static double ToFloat64(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Float64. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Returns a 64-bit floating point value. + /// + /// is used for converting string representations of numbers to Float64. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64 + public double ToFloat64(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Float64 but returns 0 in case of an error. Like - /// but returns 0 instead of throwing an exception on conversion errors. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Returns a 64-bit floating point value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrZero - public static double ToFloat64OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Float64 but returns 0 in case of an error. Like + /// but returns 0 instead of throwing an exception on conversion errors. + /// + /// Expression returning a number or a string representation of a number. + /// Returns a 64-bit floating point value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrZero + public double ToFloat64OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Float64 but returns null in case of an error. - /// Like but returns null instead of throwing an exception on conversion errors. - /// - /// DbFunctions instance. - /// A string representation of a number. - /// Returns a 64-bit Float value if successful, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrNull - public static double? ToFloat64OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Float64 but returns null in case of an error. + /// Like but returns null instead of throwing an exception on conversion errors. + /// + /// A string representation of a number. + /// Returns a 64-bit Float value if successful, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrNull + public double? ToFloat64OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// Float64 but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Returns a value of type Float64 if successful, otherwise returns the default value if passed or 0 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrDefault - public static double ToFloat64OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// Float64 but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Returns a value of type Float64 if successful, otherwise returns the default value if passed or 0 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrDefault + public double ToFloat64OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// Float64 but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// Returns a value of type Float64 if successful, otherwise returns the default value if passed or 0 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrDefault - public static double ToFloat64OrDefault(this DbFunctions _, string? expr, double defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// Float64 but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Returns a value of type Float64 if successful, otherwise returns the default value if passed or 0 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrDefault + public double ToFloat64OrDefault(string? expr, double defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs index e6ff7aa..1712341 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs @@ -6,82 +6,80 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseInt128DbFunctionsExtensions { - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128 - public static Int128 ToInt128(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128 + public Int128 ToInt128(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128 - public static Int128 ToInt128(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128 + public Int128 ToInt128(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128orzero - public static Int128 ToInt128OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128orzero + public Int128 ToInt128OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ornull - public static Int128? ToInt128OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ornull + public Int128? ToInt128OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ordefault - public static Int128 ToInt128OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ordefault + public Int128 ToInt128OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// The default value to return if parsing to type is unsuccessful. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ordefault - public static Int128 ToInt128OrDefault(this DbFunctions _, string? expr, Int128 defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// The default value to return if parsing to type is unsuccessful. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ordefault + public Int128 ToInt128OrDefault(string? expr, Int128 defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs index bba7843..d1a3e7a 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs @@ -6,80 +6,78 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseInt16DbFunctionsExtensions { - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16 - public static short ToInt16(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16 + public short ToInt16(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16 - public static short ToInt16(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16 + public short ToInt16(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - /// - public static short ToInt16OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// + /// + public short ToInt16OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ornull - public static short? ToInt16OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ornull + public short? ToInt16OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ordefault - public static short ToInt16OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ordefault + public short ToInt16OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// The default value to return if parsing to type is unsuccessful. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ordefault - public static short ToInt16OrDefault(this DbFunctions _, string? expr, short defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// The default value to return if parsing to type is unsuccessful. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ordefault + public short ToInt16OrDefault(string? expr, short defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs index 1275a56..4c35a4d 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs @@ -6,83 +6,81 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseInt32DbFunctionsExtensions { - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32 - public static int ToInt32(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32 + public int ToInt32(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32 - public static int ToInt32(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32 + public int ToInt32(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32orzero - public static int ToInt32OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32orzero + public int ToInt32OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ornull - public static int? ToInt32OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ornull + public int? ToInt32OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 - /// is returned in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ordefault - public static int ToInt32OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 + /// is returned in case of an error. + /// + /// A String representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ordefault + public int ToInt32OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 - /// is returned in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// The default value to return if parsing to type is unsuccessful. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ordefault - public static int ToInt32OrDefault(this DbFunctions _, string? expr, int defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 + /// is returned in case of an error. + /// + /// A String representation of a number. + /// The default value to return if parsing to type is unsuccessful. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ordefault + public int ToInt32OrDefault(string? expr, int defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs index 6bcd1cb..5fe4e6c 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs @@ -6,83 +6,81 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseInt64DbFunctionsExtensions { - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64 - public static long ToInt64(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64 + public long ToInt64(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64 - public static long ToInt64(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64 + public long ToInt64(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64orzero - public static long ToInt64OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64orzero + public long ToInt64OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ornull - public static long? ToInt64OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ornull + public long? ToInt64OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed - /// then 0 is returned in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ordefault - public static long ToInt64OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed + /// then 0 is returned in case of an error. + /// + /// A String representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ordefault + public long ToInt64OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed - /// then 0 is returned in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// The default value to return if parsing to type is unsuccessful. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ordefault - public static long ToInt64OrDefault(this DbFunctions _, string? expr, long defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed + /// then 0 is returned in case of an error. + /// + /// A String representation of a number. + /// The default value to return if parsing to type is unsuccessful. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ordefault + public long ToInt64OrDefault(string? expr, long defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs index 4b2ffe7..1819052 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs @@ -6,82 +6,80 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseInt8DbFunctionsExtensions { - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8 - public static sbyte ToInt8(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8 + public sbyte ToInt8(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8 - public static sbyte ToInt8(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8 + public sbyte ToInt8(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8orzero - public static sbyte ToInt8OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type but returns 0 in case of an error. + /// + /// A String representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8orzero + public sbyte ToInt8OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Int8 but returns - /// null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toInt8OrNull - public static sbyte? ToInt8OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Int8 but returns + /// null in case of an error. + /// + /// A String representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toInt8OrNull + public sbyte? ToInt8OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then - /// 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8ordefault - public static sbyte ToInt8OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then + /// 0 is returned in case of an error. + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8ordefault + public sbyte ToInt8OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then - /// 0 is returned in case of an error. - /// - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8ordefault - public static sbyte ToInt8OrDefault(this DbFunctions _, string? expr, sbyte defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then + /// 0 is returned in case of an error. + /// + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8ordefault + public sbyte ToInt8OrDefault(string? expr, sbyte defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs index 7d1fc1c..d5cdf2d 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs @@ -6,83 +6,81 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUInt128DbFunctionsExtensions { - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128 - public static UInt128 ToUInt128(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128 + public UInt128 ToUInt128(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128 - public static UInt128 ToUInt128(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128 + public UInt128 ToUInt128(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - public static UInt128 ToUInt128OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// + public UInt128 ToUInt128OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - public static UInt128? ToUInt128OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// + public UInt128? ToUInt128OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128ordefault - public static UInt128 ToUInt128OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128ordefault + public UInt128 ToUInt128OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128ordefault - public static UInt128 ToUInt128OrDefault(this DbFunctions _, string? expr, UInt128 defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128ordefault + public UInt128 ToUInt128OrDefault(string? expr, UInt128 defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs index 0bd31ed..aaadd07 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs @@ -6,83 +6,81 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUInt16DbFunctionsExtensions { - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16 - public static ushort ToUInt16(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16 + public ushort ToUInt16(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16 - public static ushort ToUInt16(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16 + public ushort ToUInt16(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - public static ushort ToUInt16OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// + public ushort ToUInt16OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - public static ushort? ToUInt16OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// + public ushort? ToUInt16OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16ordefault - public static ushort ToUInt16OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16ordefault + public ushort ToUInt16OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16ordefault - public static ushort ToUInt16OrDefault(this DbFunctions _, string? expr, ushort defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16ordefault + public ushort ToUInt16OrDefault(string? expr, ushort defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs index b7df98c..a3959b9 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs @@ -6,83 +6,81 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUInt32DbFunctionsExtensions { - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32 - public static uint ToUInt32(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32 + public uint ToUInt32(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32 - public static uint ToUInt32(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32 + public uint ToUInt32(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - public static uint ToUInt32OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// + public uint ToUInt32OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - public static uint? ToUInt32OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// + public uint? ToUInt32OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32ordefault - public static uint ToUInt32OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32ordefault + public uint ToUInt32OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32ordefault - public static uint ToUInt32OrDefault(this DbFunctions _, string? expr, uint defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32ordefault + public uint ToUInt32OrDefault(string? expr, uint defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs index cf85bb4..2f18730 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs @@ -6,83 +6,81 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUInt64DbFunctionsExtensions { - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64 - public static ulong ToUInt64(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64 + public ulong ToUInt64(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64 - public static ulong ToUInt64(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64 + public ulong ToUInt64(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - public static ulong ToUInt64OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// + public ulong ToUInt64OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - public static ulong? ToUInt64OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// + public ulong? ToUInt64OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64ordefault - public static ulong ToUInt64OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64ordefault + public ulong ToUInt64OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64ordefault - public static ulong ToUInt64OrDefault(this DbFunctions _, string? expr, ulong defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64ordefault + public ulong ToUInt64OrDefault(string? expr, ulong defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs index 2224977..46573f8 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs @@ -6,83 +6,81 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUInt8DbFunctionsExtensions { - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8 - public static byte ToUInt8(this DbFunctions _, TNumber expr) where TNumber : INumber + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8 + public byte ToUInt8(TNumber expr) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// DbFunctions instance. - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8 - public static byte ToUInt8(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8 + public byte ToUInt8(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - public static byte ToUInt8OrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// + public byte ToUInt8OrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// DbFunctions instance. - /// A String representation of a number. - /// - public static byte? ToUInt8OrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// + public byte? ToUInt8OrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8ordefault - public static byte ToUInt8OrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8ordefault + public byte ToUInt8OrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8ordefault - public static byte ToUInt8OrDefault(this DbFunctions _, string? expr, byte defaultValue) - { - throw new InvalidOperationException(); + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8ordefault + public byte ToUInt8OrDefault(string? expr, byte defaultValue) + { + throw new InvalidOperationException(); + } } } \ No newline at end of file diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs index 477cf66..b3f1a15 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs @@ -5,77 +5,76 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUuidDbFunctionsExtensions { - /// - /// Converts a String value to a UUID value. - /// /// DbFunctions instance. - /// UUID as a string. - /// Returns a UUID from the string representation of the UUID. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUUID - public static Guid ToUuid(this DbFunctions _, string? expr) + extension(DbFunctions _) { - throw new InvalidOperationException(); - } + /// + /// Converts a String value to a UUID value. + /// + /// UUID as a string. + /// Returns a UUID from the string representation of the UUID. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUUID + public Guid ToUuid(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type UUID but returns zero UUID in case of an error. - /// Like but returns zero UUID (00000000-0000-0000-0000-000000000000) - /// instead of throwing an exception on conversion errors. - /// - /// DbFunctions instance. - /// A string representation of a UUID. - /// Returns a UUID value if successful, otherwise zero UUID (00000000-0000-0000-0000-000000000000). - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static Guid ToUuidOrZero(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type UUID but returns zero UUID in case of an error. + /// Like but returns zero UUID (00000000-0000-0000-0000-000000000000) + /// instead of throwing an exception on conversion errors. + /// + /// A string representation of a UUID. + /// Returns a UUID value if successful, otherwise zero UUID (00000000-0000-0000-0000-000000000000). + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public Guid ToUuidOrZero(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts a String value to a UUID value or returns null if the string representation is invalid. - /// - /// DbFunctions instance. - /// UUID as a string. - /// Returns a UUID from the string representation of the UUID, or null if conversion fails. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static Guid? ToUuidOrNull(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts a String value to a UUID value or returns null if the string representation is invalid. + /// + /// UUID as a string. + /// Returns a UUID from the string representation of the UUID, or null if conversion fails. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public Guid? ToUuidOrNull(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts a String value to a UUID value or returns a default UUID if conversion is not possible. - /// - /// DbFunctions instance. - /// UUID as a string. - /// Returns a UUID from the string representation of the UUID or a default UUID if the input is invalid. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static Guid ToUuidOrDefault(this DbFunctions _, string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts a String value to a UUID value or returns a default UUID if conversion is not possible. + /// + /// UUID as a string. + /// Returns a UUID from the string representation of the UUID or a default UUID if the input is invalid. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public Guid ToUuidOrDefault(string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts a string value to a UUID value or returns the provided default value if the conversion is not possible. - /// - /// DbFunctions instance. - /// The string representation of the UUID. - /// The default value to return if the conversion is not possible. - /// Returns a UUID parsed from the string representation, or the default value if the conversion fails. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public static Guid ToUuidOrDefault(this DbFunctions _, string? expr, Guid defaultValue) - { - throw new InvalidOperationException(); + /// + /// Converts a string value to a UUID value or returns the provided default value if the conversion is not possible. + /// + /// The string representation of the UUID. + /// The default value to return if the conversion is not possible. + /// Returns a UUID parsed from the string representation, or the default value if the conversion fails. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public Guid ToUuidOrDefault(string? expr, Guid defaultValue) + { + throw new InvalidOperationException(); + } } } diff --git a/src/EntityFrameworkCore.ClickHouse/Query/ClickHouseSqlExpressionFactory.cs b/src/EntityFrameworkCore.ClickHouse/Query/ClickHouseSqlExpressionFactory.cs index 2c24ed9..cc84067 100644 --- a/src/EntityFrameworkCore.ClickHouse/Query/ClickHouseSqlExpressionFactory.cs +++ b/src/EntityFrameworkCore.ClickHouse/Query/ClickHouseSqlExpressionFactory.cs @@ -325,6 +325,28 @@ public SqlExpression ToDecimal256OrDefault(SqlExpression number, SqlExpression s typeMapping: GetDecimalTypaMapping(DecimalPrecision256, DecimalMaxScale256, scale)); } + public SqlExpression DivideDecimal(SqlExpression x, SqlExpression y) + { + return Function( + name: "divideDecimal", + arguments: [x, y], + nullable: true, + argumentsPropagateNullability: [true, true], + returnType: typeof(decimal), + typeMapping: GetDecimalTypaMapping(DecimalPrecision256, DecimalMaxScale256, null)); + } + + public SqlExpression DivideDecimal(SqlExpression x, SqlExpression y, SqlExpression scale) + { + return Function( + name: "divideDecimal", + arguments: [x, y, scale], + nullable: true, + argumentsPropagateNullability: [true, true, true], + returnType: typeof(decimal), + typeMapping: GetDecimalTypaMapping(DecimalPrecision256, DecimalMaxScale256, scale)); + } + private RelationalTypeMapping? GetDecimalTypaMapping(byte precision, byte maxScale, SqlExpression scale) { if (scale is SqlConstantExpression { Value: byte scaleValue }) diff --git a/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseDecimal256MethodTranslator.cs b/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseDecimal256MethodTranslator.cs index 19632b5..129624e 100644 --- a/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseDecimal256MethodTranslator.cs +++ b/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseDecimal256MethodTranslator.cs @@ -35,6 +35,10 @@ public ClickHouseDecimal256MethodTranslator(ISqlExpressionFactory sqlExpressionF nameof(ClickHouseDecimal256DbFunctionsExtensions.ToDecimal256OrDefault) => arguments.Count == 3 ? _sqlExpressionFactory.ToDecimal256OrDefault(arguments[1], arguments[2]) : _sqlExpressionFactory.ToDecimal256OrDefault(arguments[1], arguments[2], arguments[3]), + nameof(ClickHouseDecimal256DbFunctionsExtensions.DivideDecimal) => + arguments.Count == 3 + ? _sqlExpressionFactory.DivideDecimal(arguments[1], arguments[2]) + : _sqlExpressionFactory.DivideDecimal(arguments[1], arguments[2], arguments[3]), _ => null }; } diff --git a/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseDecimal32MethodTranslator.cs b/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseDecimal32MethodTranslator.cs index e2932d3..07fd247 100644 --- a/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseDecimal32MethodTranslator.cs +++ b/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseDecimal32MethodTranslator.cs @@ -15,7 +15,7 @@ public ClickHouseDecimal32MethodTranslator(ISqlExpressionFactory sqlExpressionFa { _sqlExpressionFactory = (ClickHouseSqlExpressionFactory)sqlExpressionFactory; } - + public SqlExpression? Translate( SqlExpression? instance, MethodInfo method, diff --git a/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseMathTranslator.cs b/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseMathTranslator.cs index a466480..0ef8f3e 100644 --- a/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseMathTranslator.cs +++ b/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseMathTranslator.cs @@ -84,14 +84,20 @@ public class ClickHouseMathTranslator: IMethodCallTranslator, IMemberTranslator { typeof(double).GetRuntimeMethod(nameof(double.IsFinite), [typeof(double)])!, "isFinite" } }; - private readonly ISqlExpressionFactory _sqlExpressionFactory; + private static readonly MethodInfo FloatIsNegativeInfinity = typeof(float).GetRuntimeMethod(nameof(float.IsNegativeInfinity), [typeof(float)]); + private static readonly MethodInfo FloatIsPositiveInfinity = typeof(float).GetRuntimeMethod(nameof(float.IsPositiveInfinity), [typeof(float)]); + private static readonly MethodInfo DoubleIsNegativeInfinity = typeof(double).GetRuntimeMethod(nameof(double.IsNegativeInfinity), [typeof(double)]); + private static readonly MethodInfo DoubleIsPositiveInfinity = typeof(double).GetRuntimeMethod(nameof(double.IsPositiveInfinity), [typeof(double)]); + private static readonly MethodInfo DecimalDivide = typeof(decimal).GetRuntimeMethod(nameof(decimal.Divide), [typeof(decimal), typeof(decimal)]); + + private readonly ClickHouseSqlExpressionFactory _sqlExpressionFactory; private readonly IRelationalTypeMappingSource _typeMappingSource; public ClickHouseMathTranslator( ISqlExpressionFactory sqlExpressionFactory, IRelationalTypeMappingSource typeMappingSource) { - _sqlExpressionFactory = sqlExpressionFactory; + _sqlExpressionFactory = (ClickHouseSqlExpressionFactory)sqlExpressionFactory; _typeMappingSource = typeMappingSource; } @@ -127,7 +133,7 @@ public ClickHouseMathTranslator( ); } - if (method.DeclaringType == typeof(float) && method.Name == nameof(float.IsNegativeInfinity)) + if (FloatIsNegativeInfinity.Equals(method)) { return _sqlExpressionFactory.AndAlso( _sqlExpressionFactory.Function( @@ -143,7 +149,7 @@ public ClickHouseMathTranslator( ); } - if (method.DeclaringType == typeof(float) && method.Name == nameof(float.IsPositiveInfinity)) + if (FloatIsPositiveInfinity.Equals(method)) { return _sqlExpressionFactory.AndAlso( _sqlExpressionFactory.Function( @@ -159,7 +165,7 @@ public ClickHouseMathTranslator( ); } - if (method.DeclaringType == typeof(double) && method.Name == nameof(double.IsNegativeInfinity)) + if (DoubleIsNegativeInfinity.Equals(method)) { return _sqlExpressionFactory.AndAlso( _sqlExpressionFactory.Function( @@ -175,7 +181,7 @@ public ClickHouseMathTranslator( ); } - if (method.DeclaringType == typeof(double) && method.Name == nameof(double.IsPositiveInfinity)) + if (DoubleIsPositiveInfinity.Equals(method)) { return _sqlExpressionFactory.AndAlso( _sqlExpressionFactory.Function( @@ -191,6 +197,11 @@ public ClickHouseMathTranslator( ); } + if (DecimalDivide.Equals(method)) + { + return _sqlExpressionFactory.DivideDecimal(arguments[0], arguments[1]); + } + return null; } diff --git a/test/EntityFrameworkCore.ClickHouse.Tests/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensionsTest.cs b/test/EntityFrameworkCore.ClickHouse.Tests/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensionsTest.cs index ad791a7..c946152 100644 --- a/test/EntityFrameworkCore.ClickHouse.Tests/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensionsTest.cs +++ b/test/EntityFrameworkCore.ClickHouse.Tests/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensionsTest.cs @@ -39,4 +39,16 @@ public void ToDecimal256OrDefault_StringWithDefault_ThrowsException() { Assert.Throws(() => EF.Functions.ToDecimal256OrDefault("123.45", 3, 42m)); } + + [Fact] + public void DivideDecimal_Decimal_ThrowsException() + { + Assert.Throws(() => EF.Functions.DivideDecimal(10.5m, 2.0m)); + } + + [Fact] + public void DivideDecimal_DecimalWithPrecision_ThrowsException() + { + Assert.Throws(() => EF.Functions.DivideDecimal(10.5m, 2.0m, 3)); + } } From 2a86ab87a33930940c242d008a1368cb7ef7d614 Mon Sep 17 00:00:00 2001 From: Denis Ivanov Date: Thu, 25 Dec 2025 23:23:15 +0200 Subject: [PATCH 2/3] Classic extensions --- ...ickHouseArithmeticDbFunctionsExtensions.cs | 37 +- .../ClickHouseBoolDbFunctionsExtensions.cs | 40 +- .../ClickHouseDate32DbFunctionsExtensions.cs | 178 +-- .../ClickHouseDateDbFunctionsExtensions.cs | 284 ++-- ...ickHouseDateTime64DbFunctionsExtensions.cs | 1344 +++++++++-------- ...ClickHouseDateTimeDbFunctionsExtensions.cs | 321 ++-- ...ickHouseDecimal128DbFunctionsExtensions.cs | 130 +- ...ickHouseDecimal256DbFunctionsExtensions.cs | 188 +-- ...lickHouseDecimal32DbFunctionsExtensions.cs | 140 +- ...lickHouseDecimal64DbFunctionsExtensions.cs | 130 +- .../ClickHouseFloat32DbFunctionsExtensions.cs | 176 +-- .../ClickHouseFloat64DbFunctionsExtensions.cs | 174 +-- .../ClickHouseInt128DbFunctionsExtensions.cs | 138 +- .../ClickHouseInt16DbFunctionsExtensions.cs | 134 +- .../ClickHouseInt32DbFunctionsExtensions.cs | 140 +- .../ClickHouseInt64DbFunctionsExtensions.cs | 140 +- .../ClickHouseInt8DbFunctionsExtensions.cs | 138 +- .../ClickHouseUInt128DbFunctionsExtensions.cs | 140 +- .../ClickHouseUInt16DbFunctionsExtensions.cs | 140 +- .../ClickHouseUInt32DbFunctionsExtensions.cs | 140 +- .../ClickHouseUInt64DbFunctionsExtensions.cs | 140 +- .../ClickHouseUInt8DbFunctionsExtensions.cs | 140 +- .../ClickHouseUuidDbFunctionsExtensions.cs | 131 +- 23 files changed, 2372 insertions(+), 2291 deletions(-) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs index 2e4356d..71a4ba8 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs @@ -6,27 +6,24 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseArithmeticDbFunctionsExtensions { + /// + /// Calculates the quotient of two values x and y. + /// The result type is always double. + /// Integer division is provided by the intDiv function. + /// + /// Dividend. + /// Divisor /// DbFunctions instance. - extension(DbFunctions _) + /// + /// + /// The quotient of x and y. + /// + /// Division by 0 returns double.PositiveInfinity, double.NegativeInfinity, or double.NaN. + /// + public static double Divide(this DbFunctions _, TDividend x, TDivisor y) + where TDividend : INumber + where TDivisor: INumber { - /// - /// Calculates the quotient of two values x and y. - /// The result type is always double. - /// Integer division is provided by the intDiv function. - /// - /// Dividend. - /// Divisor - /// - /// - /// The quotient of x and y. - /// - /// Division by 0 returns double.PositiveInfinity, double.NegativeInfinity, or double.NaN. - /// - public double Divide(TDividend x, TDivisor y) - where TDividend : INumber - where TDivisor: INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs index 913a9f8..a05efd5 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs @@ -6,29 +6,27 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseBoolDbFunctionsExtensions { + /// + /// Converts an input value to a value of type Bool. Throws an exception in case of an error. + /// + /// Expression returning a number or a string. /// DbFunctions instance. - extension(DbFunctions _) + /// Returns true or false based on evaluation of the argument. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tobool + public static bool ToBool(this DbFunctions _, string expr) { - /// - /// Converts an input value to a value of type Bool. Throws an exception in case of an error. - /// - /// Expression returning a number or a string. - /// Returns true or false based on evaluation of the argument. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tobool - public bool ToBool(string expr) - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Bool. Throws an exception in case of an error. - /// - /// Expression returning a number or a string. - /// Returns true or false based on evaluation of the argument. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tobool - public bool ToBool(TNumber expr) where TNumber: INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Bool. Throws an exception in case of an error. + /// + /// Expression returning a number or a string. + /// DbFunctions instance. + /// Returns true or false based on evaluation of the argument. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tobool + public static bool ToBool(this DbFunctions _, TNumber expr) where TNumber: INumber + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs index b87da79..6870428 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs @@ -5,100 +5,102 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDate32DbFunctionsExtensions { + /// + /// Converts the argument to the Date32 data type. If the value is outside the range, + /// toDate32 returns the border values supported by Date32. If the argument is of type Date, it's bounds are taken into + /// + /// The value to convert. /// DbFunctions instance. - extension(DbFunctions _) + /// Returns a calendar date. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate32 + public static DateOnly ToDate32(this DbFunctions _, string? expr) { - /// - /// Converts the argument to the Date32 data type. If the value is outside the range, - /// toDate32 returns the border values supported by Date32. If the argument is of type Date, it's bounds are taken into - /// - /// The value to convert. - /// Returns a calendar date. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate32 - public DateOnly ToDate32(string? expr) - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts the argument to the Date32 data type. If the value is outside the range, - /// toDate32 returns the border values supported by Date32. If the argument is of type Date, it's bounds are taken into - /// - /// The value to convert. - /// Returns a calendar date. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate32 - public DateOnly ToDate32(uint expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts the argument to the Date32 data type. If the value is outside the range, + /// toDate32 returns the border values supported by Date32. If the argument is of type Date, it's bounds are taken into + /// + /// The value to convert. + /// DbFunctions instance. + /// Returns a calendar date. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate32 + public static DateOnly ToDate32(this DbFunctions _, uint expr) + { + throw new InvalidOperationException(); + } - /// - /// The same as but returns the min value of Date32 if an invalid argument is received. - /// - /// The value to convert. - /// Returns a calendar date. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32orzero - public DateOnly ToDate32OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// The same as but returns the min value of Date32 if an invalid argument is received. + /// + /// The value to convert. + /// DbFunctions instance. + /// Returns a calendar date. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32orzero + public static DateOnly ToDate32OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// The same as but returns null if an invalid argument is received. - /// - /// The value to convert. - /// - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ornull - public DateOnly? ToDate32OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// The same as but returns null if an invalid argument is received. + /// + /// The value to convert. + /// DbFunctions instance. + /// + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ornull + public static DateOnly? ToDate32OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts the argument to the Date32 data type. - /// If the value is outside the range, toDate32OrDefault returns the lower border value supported by Date32. - /// If the argument has Date type, it's borders are taken into account. - /// Returns default value if an invalid argument is received. - /// - /// The value to convert. - /// Returns a calendar date. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ordefault - public DateOnly ToDate32OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts the argument to the Date32 data type. + /// If the value is outside the range, toDate32OrDefault returns the lower border value supported by Date32. + /// If the argument has Date type, it's borders are taken into account. + /// Returns default value if an invalid argument is received. + /// + /// The value to convert. + /// DbFunctions instance. + /// Returns a calendar date. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ordefault + public static DateOnly ToDate32OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts the argument to the Date32 data type. - /// If the value is outside the range, toDate32OrDefault returns the lower border value supported by Date32. - /// If the argument has Date type, it's borders are taken into account. - /// Returns default value if an invalid argument is received. - /// - /// The value to convert. - /// - /// Returns a calendar date. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ordefault - public DateOnly ToDate32OrDefault(string? expr, DateOnly defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Converts the argument to the Date32 data type. + /// If the value is outside the range, toDate32OrDefault returns the lower border value supported by Date32. + /// If the argument has Date type, it's borders are taken into account. + /// Returns default value if an invalid argument is received. + /// + /// The value to convert. + /// + /// DbFunctions instance. + /// Returns a calendar date. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todate32ordefault + public static DateOnly ToDate32OrDefault(this DbFunctions _, string? expr, DateOnly defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs index fc0200b..574e1e3 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs @@ -6,155 +6,161 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDateDbFunctionsExtensions { + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public static DateOnly ToDate(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// Input value to convert. - /// - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public DateOnly ToDate(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// Input value to convert. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public DateOnly ToDate(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// DbFunctions instance. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public static DateOnly ToDate(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// Input value to convert. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public DateOnly ToDate(DateTime expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// DbFunctions instance. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public static DateOnly ToDate(this DbFunctions _, DateTime expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// Input value to convert. - /// Time zone of the specified Date object. - /// - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public DateOnly ToDate(TNumber expr, string timeZone) where TNumber : INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// Time zone of the specified Date object. + /// DbFunctions instance. + /// + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public static DateOnly ToDate(this DbFunctions _, TNumber expr, string timeZone) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// Input value to convert. - /// Time zone of the specified Date object. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public DateOnly ToDate(string? expr, string timeZone) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// Time zone of the specified Date object. + /// DbFunctions instance. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public static DateOnly ToDate(this DbFunctions _, string? expr, string timeZone) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. - /// - /// Input value to convert. - /// Time zone of the specified Date object. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate - public DateOnly ToDate(DateTime expr, string timeZone) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. + /// + /// Input value to convert. + /// Time zone of the specified Date object. + /// DbFunctions instance. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDate + public static DateOnly ToDate(this DbFunctions _, DateTime expr, string timeZone) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Date but returns the lower boundary of Date if an invalid argument - /// is received. The same as toDate but returns lower boundary of Date if an invalid argument is received. - /// - /// A string representation of a date. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateOrZero - public DateOnly ToDateOrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Date but returns the lower boundary of Date if an invalid argument + /// is received. The same as toDate but returns lower boundary of Date if an invalid argument is received. + /// + /// A string representation of a date. + /// DbFunctions instance. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateOrZero + public static DateOnly ToDateOrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Date but returns null if an invalid argument is received. - /// The same as toDate but returns null if an invalid argument is received. - /// - /// A string representation of a date. - /// Returns the converted input value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateOrNull - public DateOnly? ToDateOrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Date but returns null if an invalid argument is received. + /// The same as toDate but returns null if an invalid argument is received. + /// + /// A string representation of a date. + /// DbFunctions instance. + /// Returns the converted input value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateOrNull + public static DateOnly? ToDateOrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like but if unsuccessful, returns a default value which is either - /// the second argument (if specified), or otherwise the lower boundary of Date. - /// - /// A string representation of a date. - /// Value of type Date if successful, otherwise returns the default value if passed or 1970-01-01 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateOnly ToDateOrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like but if unsuccessful, returns a default value which is either + /// the second argument (if specified), or otherwise the lower boundary of Date. + /// + /// A string representation of a date. + /// DbFunctions instance. + /// Value of type Date if successful, otherwise returns the default value if passed or 1970-01-01 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateOnly ToDateOrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like but if unsuccessful, returns a default value which is either - /// the second argument (if specified), or otherwise the lower boundary of Date. - /// - /// A string representation of a date. - /// The default value to return if parsing is unsuccessful. - /// Value of type Date if successful, otherwise returns the default value if passed or 1970-01-01 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateOnly ToDateOrDefault(string? expr, DateOnly defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like but if unsuccessful, returns a default value which is either + /// the second argument (if specified), or otherwise the lower boundary of Date. + /// + /// A string representation of a date. + /// The default value to return if parsing is unsuccessful. + /// DbFunctions instance. + /// Value of type Date if successful, otherwise returns the default value if passed or 1970-01-01 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateOnly ToDateOrDefault(this DbFunctions _, string? expr, DateOnly defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs index 242fc3f..4ec3315 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs @@ -6,660 +6,696 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDateTime64DbFunctionsExtensions { + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). /// DbFunctions instance. - extension(DbFunctions _) - { - /// - /// Converts an input value to a value of type DateTime64. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64(string expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified datetime64 object. - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64(string expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64(uint expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified datetime64 object. - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64(uint expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64(DateOnly expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified datetime64 object. - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64(DateOnly expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64(float expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Converts an input value to a value of type DateTime64. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified datetime64 object. - /// A calendar date and time of day, with sub-second precision. - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64(float expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64OrZero(string expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified datetime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64OrZero(string expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64OrZero(uint expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64OrZero(uint expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64OrZero(DateTime expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64OrZero(DateTime expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64OrZero(float expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns the min value of DateTime64 if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime ToDateTime64OrZero(float expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public DateTime? ToDateTime64OrNull(string expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public DateTime? ToDateTime64OrNull(string expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public DateTime? ToDateTime64OrNull(uint expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public DateTime? ToDateTime64OrNull(uint expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public DateTime? ToDateTime64OrNull(DateTime expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public DateTime? ToDateTime64OrNull(DateTime expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - public DateTime? ToDateTime64OrNull(float expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value of type DateTime64 - /// but returns null if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public DateTime? ToDateTime64OrNull(float expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime? ToDateTime64OrDefault(string expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(string expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(uint expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(uint expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(DateTime expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(DateTime expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(float expr, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(float expr, [Range(0, 9)] byte scale, string timeZone) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime? ToDateTime64OrDefault(string expr, [Range(0, 9)] byte scale, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(string expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(uint expr, [Range(0, 9)] byte scale, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(uint expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(DateTime expr, [Range(0, 9)] byte scale, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(DateTime expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(float expr, [Range(0, 9)] byte scale, DateTime defaultValue) - { - throw new InvalidOperationException(); - } - - /// - /// Like , this function converts an input value to a value - /// of type DateTime64, but returns either the default value of DateTime64 or the provided default - /// if an invalid argument is received. - /// - /// The value. - /// Tick size (precision). - /// Time zone of the specified DateTime64 object. - /// Default value to return if an invalid argument is received. - /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault - public DateTime ToDateTime64OrDefault(float expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) - { - throw new InvalidOperationException(); - } + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64(this DbFunctions _, string expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified datetime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64(this DbFunctions _, string expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64(this DbFunctions _, uint expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified datetime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64(this DbFunctions _, DateOnly expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified datetime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64(this DbFunctions _, DateOnly expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64(this DbFunctions _, float expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Converts an input value to a value of type DateTime64. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified datetime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision. + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64(this DbFunctions _, float expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64OrZero(this DbFunctions _, string expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified datetime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64OrZero(this DbFunctions _, string expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64OrZero(this DbFunctions _, uint expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64OrZero(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64OrZero(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64OrZero(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns the min value of DateTime64 if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64: 1970-01-01 01:00:00.000 + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public static DateTime? ToDateTime64OrNull(this DbFunctions _, string expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public static DateTime? ToDateTime64OrNull(this DbFunctions _, string expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public static DateTime? ToDateTime64OrNull(this DbFunctions _, uint expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public static DateTime? ToDateTime64OrNull(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public static DateTime? ToDateTime64OrNull(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public static DateTime? ToDateTime64OrNull(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + public static DateTime? ToDateTime64OrNull(this DbFunctions _, float expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value of type DateTime64 + /// but returns null if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static DateTime? ToDateTime64OrNull(this DbFunctions _, float expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime? ToDateTime64OrDefault(this DbFunctions _, string expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, string expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Range(0, 9)] byte scale, string timeZone) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Default value to return if an invalid argument is received. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime? ToDateTime64OrDefault(this DbFunctions _, string expr, [Range(0, 9)] byte scale, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// Default value to return if an invalid argument is received. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, string expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Default value to return if an invalid argument is received. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// Default value to return if an invalid argument is received. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Default value to return if an invalid argument is received. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// Default value to return if an invalid argument is received. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Default value to return if an invalid argument is received. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Range(0, 9)] byte scale, DateTime defaultValue) + { + throw new InvalidOperationException(); + } + + /// + /// Like , this function converts an input value to a value + /// of type DateTime64, but returns either the default value of DateTime64 or the provided default + /// if an invalid argument is received. + /// + /// The value. + /// Tick size (precision). + /// Time zone of the specified DateTime64 object. + /// Default value to return if an invalid argument is received. + /// DbFunctions instance. + /// A calendar date and time of day, with sub-second precision, otherwise the minimum value of DateTime64 or the default value if provided. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#todatetime64ordefault + public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Range(0, 9)] byte scale, string timeZone, DateTime defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs index cf72c4e..18b7993 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs @@ -6,174 +6,181 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDateTimeDbFunctionsExtensions { + /// + /// Converts an input value to type DateTime. + /// + /// The value. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public static DateTime ToDateTime(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to type DateTime. - /// - /// The value. - /// - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public DateTime ToDateTime(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type DateTime. - /// - /// The value. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public DateTime ToDateTime(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// DbFunctions instance. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public static DateTime ToDateTime(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type DateTime. - /// - /// The value. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public DateTime ToDateTime(DateOnly expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// DbFunctions instance. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public static DateTime ToDateTime(this DbFunctions _, DateOnly expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type DateTime. - /// - /// The value. - /// Time zone. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public DateTime ToDateTime(TNumber expr, string timeZone) where TNumber : INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// Time zone. + /// DbFunctions instance. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public static DateTime ToDateTime(this DbFunctions _, TNumber expr, string timeZone) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type DateTime. - /// - /// The value. - /// Time zone. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public DateTime ToDateTime(string? expr, string timeZone) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// Time zone. + /// DbFunctions instance. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public static DateTime ToDateTime(this DbFunctions _, string? expr, string timeZone) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to type DateTime. - /// - /// The value. - /// Time zone. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime - public DateTime ToDateTime(DateOnly expr, string timeZone) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to type DateTime. + /// + /// The value. + /// Time zone. + /// DbFunctions instance. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTime + public static DateTime ToDateTime(this DbFunctions _, DateOnly expr, string timeZone) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type DateTime but returns the lower boundary of DateTime - /// if an invalid argument is received. - /// The same as toDateTime but returns lower boundary of DateTime if an invalid argument is received. - /// - /// The value. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrZero - public DateTime ToDateTimeOrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type DateTime but returns the lower boundary of DateTime + /// if an invalid argument is received. + /// The same as toDateTime but returns lower boundary of DateTime if an invalid argument is received. + /// + /// The value. + /// DbFunctions instance. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrZero + public static DateTime ToDateTimeOrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type DateTime but returns null if an invalid argument is received. - /// The same as but returns if an invalid argument is received. - /// - /// The value. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrNull - public DateTime? ToDateTimeOrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type DateTime but returns null if an invalid argument is received. + /// The same as but returns if an invalid argument is received. + /// + /// The value. + /// DbFunctions instance. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrNull + public static DateTime? ToDateTimeOrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), - /// or otherwise the lower boundary of DateTime. - /// - /// The value. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault - public DateTime ToDateTimeOrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), + /// or otherwise the lower boundary of DateTime. + /// + /// The value. + /// DbFunctions instance. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault + public static DateTime ToDateTimeOrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), - /// or otherwise the lower boundary of DateTime. - /// - /// The value. - /// Time zone. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault - public DateTime ToDateTimeOrDefault(string? expr, string timeZone) - { - throw new InvalidOperationException(); - } + /// + /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), + /// or otherwise the lower boundary of DateTime. + /// + /// The value. + /// Time zone. + /// DbFunctions instance. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault + public static DateTime ToDateTimeOrDefault(this DbFunctions _, string? expr, string timeZone) + { + throw new InvalidOperationException(); + } - /// - /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), - /// or otherwise the lower boundary of DateTime. - /// - /// The value. - /// Time zone. - /// The default value to return if parsing is unsuccessful. - /// Returns a date time. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault - public DateTime ToDateTimeOrDefault(string? expr, string timeZone, DateTime defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like toDateTime but if unsuccessful, returns a default value which is either the third argument (if specified), + /// or otherwise the lower boundary of DateTime. + /// + /// The value. + /// Time zone. + /// The default value to return if parsing is unsuccessful. + /// DbFunctions instance. + /// Returns a date time. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toDateTimeOrDefault + public static DateTime ToDateTimeOrDefault(this DbFunctions _, string? expr, string timeZone, DateTime defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs index c36b8c8..251b6ae 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs @@ -7,76 +7,78 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDecimal128DbFunctionsExtensions { + /// + /// Converts an input value to a value of type Decimal(38, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. /// DbFunctions instance. - extension(DbFunctions _) + /// + public static decimal ToDecimal128(this DbFunctions _, string number, [Range(0, 38)] byte scale) { - /// - /// Converts an input value to a value of type Decimal(38, S) with scale of S. Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal128(string number, [Range(0, 38)] byte scale) - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Decimal(38, S) with scale of S. Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal128(TNumber number, [Range(0, 38)] byte scale) where TNumber : INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(38, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal ToDecimal128(this DbFunctions _, TNumber number, [Range(0, 38)] byte scale) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(38, S) but returns 0 in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal128OrZero(string? number, [Range(0, 38)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(38, S) but returns 0 in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal ToDecimal128OrZero(this DbFunctions _, string? number, [Range(0, 38)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// Nullable(Decimal(38, S)) but returns null in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - /// - public decimal? ToDecimal128OrNull(string? number, [Range(0, 38)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// Nullable(Decimal(38, S)) but returns null in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + /// + public static decimal? ToDecimal128OrNull(this DbFunctions _, string? number, [Range(0, 38)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(38, S) but returns the default value in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal128OrDefault(string? number, [Range(0, 38)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(38, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal ToDecimal128OrDefault(this DbFunctions _, string? number, [Range(0, 38)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(38, S) but returns the default value in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. - /// - /// - public decimal ToDecimal128OrDefault(string? number, [Range(0, 38)] byte scale, decimal defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(38, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 38, specifying how many digits the fractional part of a number can have. + /// + /// DbFunctions instance. + /// + public static decimal ToDecimal128OrDefault(this DbFunctions _, string? number, [Range(0, 38)] byte scale, decimal defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs index 9bb88bf..2453801 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs @@ -7,106 +7,110 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDecimal256DbFunctionsExtensions { + /// + /// Converts an input value to a value of type Decimal(76, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. /// DbFunctions instance. - extension(DbFunctions _) + /// + public static decimal ToDecimal256(this DbFunctions _, string number, [Range(0, 76)] byte scale) { - /// - /// Converts an input value to a value of type Decimal(76, S) with scale of S. Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal256(string number, [Range(0, 76)] byte scale) - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Decimal(76, S) with scale of S. Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal256(TNumber number, [Range(0, 76)] byte scale) where TNumber : INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(76, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal ToDecimal256(this DbFunctions _, TNumber number, [Range(0, 76)] byte scale) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(76, S) but returns 0 in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// - /// - public decimal ToDecimal256OrZero(string? number, [Range(0, 76)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(76, S) but returns 0 in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + /// + public static decimal ToDecimal256OrZero(this DbFunctions _, string? number, [Range(0, 76)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Nullable(Decimal(76, S)) but returns null in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// - public decimal? ToDecimal256OrNull(string? number, [Range(0, 76)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Nullable(Decimal(76, S)) but returns null in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal? ToDecimal256OrNull(this DbFunctions _, string? number, [Range(0, 76)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(76, S) but returns the default value in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// - public decimal? ToDecimal256OrDefault(string? number, [Range(0, 76)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(76, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal? ToDecimal256OrDefault(this DbFunctions _, string? number, [Range(0, 76)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(76, S) but returns the default value in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. - /// The default value to return if parsing to type Decimal256(S) is unsuccessful. - /// - public decimal? ToDecimal256OrDefault(string? number, [Range(0, 76)] byte scale, decimal defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(76, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 76, specifying how many digits the fractional part of a number can have. + /// The default value to return if parsing to type Decimal256(S) is unsuccessful. + /// DbFunctions instance. + /// + public static decimal? ToDecimal256OrDefault(this DbFunctions _, string? number, [Range(0, 76)] byte scale, decimal defaultValue) + { + throw new InvalidOperationException(); + } - /// - /// Performs division on two decimals. Result value will be of type Decimal256. - /// - /// First value. - /// Second value. - /// - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/arithmetic-functions#divideDecimal - public decimal DivideDecimal(decimal x, decimal y) - { - throw new InvalidOperationException(); - } + /// + /// Performs division on two decimals. Result value will be of type Decimal256. + /// + /// First value. + /// Second value. + /// DbFunctions instance. + /// + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/arithmetic-functions#divideDecimal + public static decimal DivideDecimal(this DbFunctions _, decimal x, decimal y) + { + throw new InvalidOperationException(); + } - /// - /// Performs division on two decimals. Result value will be of type Decimal256. - /// - /// First value. - /// Second value. - /// Scale of result. - /// - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/arithmetic-functions#divideDecimal - public decimal DivideDecimal(decimal x, decimal y, [Range(0, 76)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Performs division on two decimals. Result value will be of type Decimal256. + /// + /// First value. + /// Second value. + /// Scale of result. + /// DbFunctions instance. + /// + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/arithmetic-functions#divideDecimal + public static decimal DivideDecimal(this DbFunctions _, decimal x, decimal y, [Range(0, 76)] byte scale) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal32DbFunctionsExtensions.cs index c973b02..7072d92 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal32DbFunctionsExtensions.cs @@ -7,81 +7,83 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDecimal32DbFunctionsExtensions { + /// + /// Converts an input value to a value of type Decimal(9, S) with scale of S. + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. /// DbFunctions instance. - extension(DbFunctions _) + /// + public static decimal ToDecimal32(this DbFunctions _, string number, [Range(0, 9)] byte scale) { - /// - /// Converts an input value to a value of type Decimal(9, S) with scale of S. - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal32(string number, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Decimal(9, S) with scale of S. - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal32(TNumber number, [Range(0, 9)] byte scale) where TNumber: INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(9, S) with scale of S. + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal ToDecimal32(this DbFunctions _, TNumber number, [Range(0, 9)] byte scale) where TNumber: INumber + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(9, S) - /// but returns 0 in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal32OrZero(string? number, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(9, S) + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal ToDecimal32OrZero(this DbFunctions _, string? number, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(9, S) - /// but returns null in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - public decimal? ToDecimal32OrNull(string? number, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(9, S) + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal? ToDecimal32OrNull(this DbFunctions _, string? number, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(9, S) - /// but returns the default value in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - /// - public decimal ToDecimal32OrDefault(string? number, [Range(0, 9)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(9, S) + /// but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + /// + public static decimal ToDecimal32OrDefault(this DbFunctions _, string? number, [Range(0, 9)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(9, S) - /// but returns the default value in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. - /// - /// - public decimal ToDecimal32OrDefault(string? number, [Range(0, 9)] byte scale, decimal defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(9, S) + /// but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 9, specifying how many digits the fractional part of a number can have. + /// + /// DbFunctions instance. + /// + public static decimal ToDecimal32OrDefault(this DbFunctions _, string? number, [Range(0, 9)] byte scale, decimal defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs index b70951a..2c53e4f 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs @@ -7,76 +7,78 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseDecimal64DbFunctionsExtensions { + /// + /// Converts an input value to a value of type Decimal(18, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. /// DbFunctions instance. - extension(DbFunctions _) + /// + public static decimal ToDecimal64(this DbFunctions _, string number, [Range(0, 18)] byte scale) { - /// - /// Converts an input value to a value of type Decimal(18, S) with scale of S. Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal64(string number, [Range(0, 18)] byte scale) - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Decimal(18, S) with scale of S. Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal64(TNumber number, [Range(0, 18)] byte scale) where TNumber : INumber - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Decimal(18, S) with scale of S. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal ToDecimal64(this DbFunctions _, TNumber number, [Range(0, 18)] byte scale) where TNumber : INumber + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(18, S) - /// but returns 0 in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal64OrZero(string? number, [Range(0, 18)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(18, S) + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal ToDecimal64OrZero(this DbFunctions _, string? number, [Range(0, 18)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Nullable(Decimal(18, S)) - /// but returns null in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - public decimal? ToDecimal64OrNull(string? number, [Range(0, 18)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Nullable(Decimal(18, S)) + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal? ToDecimal64OrNull(this DbFunctions _, string? number, [Range(0, 18)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(18, S) but returns the default value in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - public decimal ToDecimal64OrDefault(string? number, [Range(0, 18)] byte scale) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(18, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// DbFunctions instance. + /// + public static decimal ToDecimal64OrDefault(this DbFunctions _, string? number, [Range(0, 18)] byte scale) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Decimal(18, S) but returns the default value in case of an error. - /// - /// A String representation of a number. - /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. - /// - /// - public decimal ToDecimal64OrDefault(string? number, [Range(0, 18)] byte scale, decimal defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Decimal(18, S) but returns the default value in case of an error. + /// + /// A String representation of a number. + /// Scale parameter between 0 and 18, specifying how many digits the fractional part of a number can have. + /// + /// DbFunctions instance. + /// + public static decimal ToDecimal64OrDefault(this DbFunctions _, string? number, [Range(0, 18)] byte scale, decimal defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs index 420a8f1..502de17 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs @@ -6,99 +6,101 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseFloat32DbFunctionsExtensions { + /// + /// Converts an input value to a value of type Float32. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// 32-bit floating point value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32 + public static float ToFloat32(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type Float32. Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// 32-bit floating point value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32 - public float ToFloat32(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Float32. Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// 32-bit floating point value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32 - public float ToFloat32(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Float32. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// 32-bit floating point value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32 + public static float ToFloat32(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value - /// of type Float32 but returns 0 in case of an error. - /// - /// A String representation of a number. - /// 32-bit Float value if successful, otherwise 0. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32orzero - public float ToFloat32OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value + /// of type Float32 but returns 0 in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// 32-bit Float value if successful, otherwise 0. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32orzero + public static float ToFloat32OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value - /// of type Float32 but returns null in case of an error. - /// - /// A String representation of a number. - /// 32-bit Float value if successful, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ornull - public float? ToFloat32OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value + /// of type Float32 but returns null in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// 32-bit Float value if successful, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ornull + public static float? ToFloat32OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Float32 - /// but returns the default value in case of an error. If no default value is passed - /// then 0 is returned in case of an error. - /// - /// A String representation of a number. - /// 32-bit Float value if successful, otherwise returns the default value if passed or 0 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ordefault - public float ToFloat32OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Float32 + /// but returns the default value in case of an error. If no default value is passed + /// then 0 is returned in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// 32-bit Float value if successful, otherwise returns the default value if passed or 0 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ordefault + public static float ToFloat32OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Float32 - /// but returns the default value in case of an error. If no default value is passed - /// then 0 is returned in case of an error. - /// - /// A String representation of a number. - /// The default value to return if parsing to type Float32 is unsuccessful. - /// 32-bit Float value if successful, otherwise returns the default value if passed or 0 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ordefault - public float ToFloat32OrDefault(string? expr, float defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Float32 + /// but returns the default value in case of an error. If no default value is passed + /// then 0 is returned in case of an error. + /// + /// A String representation of a number. + /// The default value to return if parsing to type Float32 is unsuccessful. + /// DbFunctions instance. + /// 32-bit Float value if successful, otherwise returns the default value if passed or 0 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#tofloat32ordefault + public static float ToFloat32OrDefault(this DbFunctions _, string? expr, float defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs index 6d330a8..be004bb 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs @@ -6,98 +6,100 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseFloat64DbFunctionsExtensions { + /// + /// Converts an input value to a value of type Float64. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// Returns a 64-bit floating point value. + /// + /// is used for converting string representations of numbers to Float64. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64 + public static double ToFloat64(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type Float64. Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// Returns a 64-bit floating point value. - /// - /// is used for converting string representations of numbers to Float64. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64 - public double ToFloat64(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Float64. Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Returns a 64-bit floating point value. - /// - /// is used for converting string representations of numbers to Float64. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64 - public double ToFloat64(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Float64. Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// Returns a 64-bit floating point value. + /// + /// is used for converting string representations of numbers to Float64. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64 + public static double ToFloat64(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Float64 but returns 0 in case of an error. Like - /// but returns 0 instead of throwing an exception on conversion errors. - /// - /// Expression returning a number or a string representation of a number. - /// Returns a 64-bit floating point value. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrZero - public double ToFloat64OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Float64 but returns 0 in case of an error. Like + /// but returns 0 instead of throwing an exception on conversion errors. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// Returns a 64-bit floating point value. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrZero + public static double ToFloat64OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type Float64 but returns null in case of an error. - /// Like but returns null instead of throwing an exception on conversion errors. - /// - /// A string representation of a number. - /// Returns a 64-bit Float value if successful, otherwise null. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrNull - public double? ToFloat64OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type Float64 but returns null in case of an error. + /// Like but returns null instead of throwing an exception on conversion errors. + /// + /// A string representation of a number. + /// DbFunctions instance. + /// Returns a 64-bit Float value if successful, otherwise null. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrNull + public static double? ToFloat64OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// Float64 but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Returns a value of type Float64 if successful, otherwise returns the default value if passed or 0 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrDefault - public double ToFloat64OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// Float64 but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// Returns a value of type Float64 if successful, otherwise returns the default value if passed or 0 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrDefault + public static double ToFloat64OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// Float64 but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// Returns a value of type Float64 if successful, otherwise returns the default value if passed or 0 if not. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrDefault - public double ToFloat64OrDefault(string? expr, double defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// Float64 but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// Returns a value of type Float64 if successful, otherwise returns the default value if passed or 0 if not. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toFloat64OrDefault + public static double ToFloat64OrDefault(this DbFunctions _, string? expr, double defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs index 1712341..2f26dff 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs @@ -6,80 +6,82 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseInt128DbFunctionsExtensions { + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128 + public static Int128 ToInt128(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128 - public Int128 ToInt128(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128 - public Int128 ToInt128(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128 + public static Int128 ToInt128(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128orzero - public Int128 ToInt128OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128orzero + public static Int128 ToInt128OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ornull - public Int128? ToInt128OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ornull + public static Int128? ToInt128OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ordefault - public Int128 ToInt128OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ordefault + public static Int128 ToInt128OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// The default value to return if parsing to type is unsuccessful. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ordefault - public Int128 ToInt128OrDefault(string? expr, Int128 defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// The default value to return if parsing to type is unsuccessful. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ordefault + public static Int128 ToInt128OrDefault(this DbFunctions _, string? expr, Int128 defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs index d1a3e7a..cff974a 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs @@ -6,78 +6,80 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseInt16DbFunctionsExtensions { + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16 + public static short ToInt16(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16 - public short ToInt16(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16 - public short ToInt16(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16 + public static short ToInt16(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// A String representation of a number. - /// - /// - public short ToInt16OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + /// + public static short ToInt16OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ornull - public short? ToInt16OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ornull + public static short? ToInt16OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ordefault - public short ToInt16OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ordefault + public static short ToInt16OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// The default value to return if parsing to type is unsuccessful. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ordefault - public short ToInt16OrDefault(string? expr, short defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 is returned in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// The default value to return if parsing to type is unsuccessful. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ordefault + public static short ToInt16OrDefault(this DbFunctions _, string? expr, short defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs index 4c35a4d..dd54c40 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs @@ -6,81 +6,83 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseInt32DbFunctionsExtensions { + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32 + public static int ToInt32(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32 - public int ToInt32(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32 - public int ToInt32(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32 + public static int ToInt32(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32orzero - public int ToInt32OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32orzero + public static int ToInt32OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ornull - public int? ToInt32OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ornull + public static int? ToInt32OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 - /// is returned in case of an error. - /// - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ordefault - public int ToInt32OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 + /// is returned in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ordefault + public static int ToInt32OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then 0 - /// is returned in case of an error. - /// - /// A String representation of a number. - /// The default value to return if parsing to type is unsuccessful. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ordefault - public int ToInt32OrDefault(string? expr, int defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then 0 + /// is returned in case of an error. + /// + /// A String representation of a number. + /// The default value to return if parsing to type is unsuccessful. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ordefault + public static int ToInt32OrDefault(this DbFunctions _, string? expr, int defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs index 5fe4e6c..97d640e 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs @@ -6,81 +6,83 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseInt64DbFunctionsExtensions { + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64 + public static long ToInt64(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64 - public long ToInt64(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64 - public long ToInt64(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64 + public static long ToInt64(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// A String representation of a number - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64orzero - public long ToInt64OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64orzero + public static long ToInt64OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ornull - public long? ToInt64OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ornull + public static long? ToInt64OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed - /// then 0 is returned in case of an error. - /// - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ordefault - public long ToInt64OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed + /// then 0 is returned in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ordefault + public static long ToInt64OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed - /// then 0 is returned in case of an error. - /// - /// A String representation of a number. - /// The default value to return if parsing to type is unsuccessful. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ordefault - public long ToInt64OrDefault(string? expr, long defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed + /// then 0 is returned in case of an error. + /// + /// A String representation of a number. + /// The default value to return if parsing to type is unsuccessful. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ordefault + public static long ToInt64OrDefault(this DbFunctions _, string? expr, long defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs index 1819052..f89e233 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs @@ -6,80 +6,82 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseInt8DbFunctionsExtensions { + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8 + public static sbyte ToInt8(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8 - public sbyte ToInt8(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8 - public sbyte ToInt8(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8 + public static sbyte ToInt8(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type but returns 0 in case of an error. - /// - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8orzero - public sbyte ToInt8OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type but returns 0 in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8orzero + public static sbyte ToInt8OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type Int8 but returns - /// null in case of an error. - /// - /// A String representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toInt8OrNull - public sbyte? ToInt8OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type Int8 but returns + /// null in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toInt8OrNull + public static sbyte? ToInt8OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then - /// 0 is returned in case of an error. - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8ordefault - public sbyte ToInt8OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then + /// 0 is returned in case of an error. + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8ordefault + public static sbyte ToInt8OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. If no default value is passed then - /// 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8ordefault - public sbyte ToInt8OrDefault(string? expr, sbyte defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. If no default value is passed then + /// 0 is returned in case of an error. + /// + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8ordefault + public static sbyte ToInt8OrDefault(this DbFunctions _, string? expr, sbyte defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs index d5cdf2d..914acbc 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs @@ -6,81 +6,83 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUInt128DbFunctionsExtensions { + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128 + public static UInt128 ToUInt128(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128 - public UInt128 ToUInt128(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128 - public UInt128 ToUInt128(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128 + public static UInt128 ToUInt128(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// A String representation of a number. - /// - public UInt128 ToUInt128OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + public static UInt128 ToUInt128OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// A String representation of a number. - /// - public UInt128? ToUInt128OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + public static UInt128? ToUInt128OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128ordefault - public UInt128 ToUInt128OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128ordefault + public static UInt128 ToUInt128OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128ordefault - public UInt128 ToUInt128OrDefault(string? expr, UInt128 defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128ordefault + public static UInt128 ToUInt128OrDefault(this DbFunctions _, string? expr, UInt128 defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs index aaadd07..1c1adb1 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs @@ -6,81 +6,83 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUInt16DbFunctionsExtensions { + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16 + public static ushort ToUInt16(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16 - public ushort ToUInt16(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16 - public ushort ToUInt16(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16 + public static ushort ToUInt16(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// A String representation of a number. - /// - public ushort ToUInt16OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + public static ushort ToUInt16OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// A String representation of a number. - /// - public ushort? ToUInt16OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + public static ushort? ToUInt16OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16ordefault - public ushort ToUInt16OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16ordefault + public static ushort ToUInt16OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16ordefault - public ushort ToUInt16OrDefault(string? expr, ushort defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16ordefault + public static ushort ToUInt16OrDefault(this DbFunctions _, string? expr, ushort defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs index a3959b9..c40b6ac 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs @@ -6,81 +6,83 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUInt32DbFunctionsExtensions { + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32 + public static uint ToUInt32(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32 - public uint ToUInt32(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32 - public uint ToUInt32(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32 + public static uint ToUInt32(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// A String representation of a number. - /// - public uint ToUInt32OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + public static uint ToUInt32OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// A String representation of a number. - /// - public uint? ToUInt32OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + public static uint? ToUInt32OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32ordefault - public uint ToUInt32OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32ordefault + public static uint ToUInt32OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32ordefault - public uint ToUInt32OrDefault(string? expr, uint defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32ordefault + public static uint ToUInt32OrDefault(this DbFunctions _, string? expr, uint defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs index 2f18730..36dc4ed 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs @@ -6,81 +6,83 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUInt64DbFunctionsExtensions { + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64 + public static ulong ToUInt64(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64 - public ulong ToUInt64(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64 - public ulong ToUInt64(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64 + public static ulong ToUInt64(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// A String representation of a number. - /// - public ulong ToUInt64OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + public static ulong ToUInt64OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// A String representation of a number. - /// - public ulong? ToUInt64OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + public static ulong? ToUInt64OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64ordefault - public ulong ToUInt64OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64ordefault + public static ulong ToUInt64OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64ordefault - public ulong ToUInt64OrDefault(string? expr, ulong defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64ordefault + public static ulong ToUInt64OrDefault(this DbFunctions _, string? expr, ulong defaultValue) + { + throw new InvalidOperationException(); } } diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs index 46573f8..a287945 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs @@ -6,81 +6,83 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUInt8DbFunctionsExtensions { + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. /// DbFunctions instance. - extension(DbFunctions _) + /// + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8 + public static byte ToUInt8(this DbFunctions _, TNumber expr) where TNumber : INumber { - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8 - public byte ToUInt8(TNumber expr) where TNumber : INumber - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type . - /// Throws an exception in case of an error. - /// - /// Expression returning a number or a string representation of a number. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8 - public byte ToUInt8(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type . + /// Throws an exception in case of an error. + /// + /// Expression returning a number or a string representation of a number. + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8 + public static byte ToUInt8(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns 0 in case of an error. - /// - /// A String representation of a number. - /// - public byte ToUInt8OrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns 0 in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + public static byte ToUInt8OrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns null in case of an error. - /// - /// A String representation of a number. - /// - public byte? ToUInt8OrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns null in case of an error. + /// + /// A String representation of a number. + /// DbFunctions instance. + /// + public static byte? ToUInt8OrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8ordefault - public byte ToUInt8OrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8ordefault + public static byte ToUInt8OrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Like , this function converts an input value to a value of type - /// but returns the default value in case of an error. - /// If no default value is passed then 0 is returned in case of an error. - /// - /// - /// - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8ordefault - public byte ToUInt8OrDefault(string? expr, byte defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Like , this function converts an input value to a value of type + /// but returns the default value in case of an error. + /// If no default value is passed then 0 is returned in case of an error. + /// + /// + /// + /// DbFunctions instance. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8ordefault + public static byte ToUInt8OrDefault(this DbFunctions _, string? expr, byte defaultValue) + { + throw new InvalidOperationException(); } } \ No newline at end of file diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs index b3f1a15..bcfeafc 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs @@ -5,76 +5,77 @@ namespace Microsoft.EntityFrameworkCore; public static class ClickHouseUuidDbFunctionsExtensions { + /// + /// Converts a String value to a UUID value. + /// + /// UUID as a string. /// DbFunctions instance. - extension(DbFunctions _) + /// Returns a UUID from the string representation of the UUID. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUUID + public static Guid ToUuid(this DbFunctions _, string? expr) { - /// - /// Converts a String value to a UUID value. - /// - /// UUID as a string. - /// Returns a UUID from the string representation of the UUID. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUUID - public Guid ToUuid(string? expr) - { - throw new InvalidOperationException(); - } + throw new InvalidOperationException(); + } - /// - /// Converts an input value to a value of type UUID but returns zero UUID in case of an error. - /// Like but returns zero UUID (00000000-0000-0000-0000-000000000000) - /// instead of throwing an exception on conversion errors. - /// - /// A string representation of a UUID. - /// Returns a UUID value if successful, otherwise zero UUID (00000000-0000-0000-0000-000000000000). - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public Guid ToUuidOrZero(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts an input value to a value of type UUID but returns zero UUID in case of an error. + /// Like but returns zero UUID (00000000-0000-0000-0000-000000000000) + /// instead of throwing an exception on conversion errors. + /// + /// A string representation of a UUID. + /// DbFunctions instance. + /// Returns a UUID value if successful, otherwise zero UUID (00000000-0000-0000-0000-000000000000). + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static Guid ToUuidOrZero(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts a String value to a UUID value or returns null if the string representation is invalid. - /// - /// UUID as a string. - /// Returns a UUID from the string representation of the UUID, or null if conversion fails. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public Guid? ToUuidOrNull(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts a String value to a UUID value or returns null if the string representation is invalid. + /// + /// UUID as a string. + /// DbFunctions instance. + /// Returns a UUID from the string representation of the UUID, or null if conversion fails. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static Guid? ToUuidOrNull(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts a String value to a UUID value or returns a default UUID if conversion is not possible. - /// - /// UUID as a string. - /// Returns a UUID from the string representation of the UUID or a default UUID if the input is invalid. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public Guid ToUuidOrDefault(string? expr) - { - throw new InvalidOperationException(); - } + /// + /// Converts a String value to a UUID value or returns a default UUID if conversion is not possible. + /// + /// UUID as a string. + /// DbFunctions instance. + /// Returns a UUID from the string representation of the UUID or a default UUID if the input is invalid. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static Guid ToUuidOrDefault(this DbFunctions _, string? expr) + { + throw new InvalidOperationException(); + } - /// - /// Converts a string value to a UUID value or returns the provided default value if the conversion is not possible. - /// - /// The string representation of the UUID. - /// The default value to return if the conversion is not possible. - /// Returns a UUID parsed from the string representation, or the default value if the conversion fails. - /// - /// is only intended for use via SQL translation as part of an EF Core LINQ query. - /// - public Guid ToUuidOrDefault(string? expr, Guid defaultValue) - { - throw new InvalidOperationException(); - } + /// + /// Converts a string value to a UUID value or returns the provided default value if the conversion is not possible. + /// + /// The string representation of the UUID. + /// The default value to return if the conversion is not possible. + /// DbFunctions instance. + /// Returns a UUID parsed from the string representation, or the default value if the conversion fails. + /// + /// is only intended for use via SQL translation as part of an EF Core LINQ query. + /// + public static Guid ToUuidOrDefault(this DbFunctions _, string? expr, Guid defaultValue) + { + throw new InvalidOperationException(); } } From f24d0b3670811c6ea6dfb841fa39c258e2d7d810 Mon Sep 17 00:00:00 2001 From: Denis Ivanov Date: Fri, 26 Dec 2025 00:47:35 +0200 Subject: [PATCH 3/3] Decimal mapping --- .../ClickHouseAnnotationCodeGenerator.cs | 2 +- .../Internal/ClickHouseRowValueExpression.cs | 10 +++--- .../ClickHouseSqlNullabilityProcessor.cs | 2 +- .../Internal/ClickHouseTypeMappingSource.cs | 2 +- .../Mapping/ClickHouseDecimalTypeMapping.cs | 31 ++++++++++--------- .../Storage/Json/JsonInt128ReaderWriter.cs | 2 +- .../Storage/Json/JsonUInt128ReaderWriter.cs | 2 +- ...eticDbFunctionsExtensionsClickHouseTest.cs | 23 ++++++++++++++ .../Query/TypeConversionTest.cs | 14 ++++----- 9 files changed, 57 insertions(+), 31 deletions(-) diff --git a/src/EntityFrameworkCore.ClickHouse/Design/Internal/ClickHouseAnnotationCodeGenerator.cs b/src/EntityFrameworkCore.ClickHouse/Design/Internal/ClickHouseAnnotationCodeGenerator.cs index bc24a04..1937089 100644 --- a/src/EntityFrameworkCore.ClickHouse/Design/Internal/ClickHouseAnnotationCodeGenerator.cs +++ b/src/EntityFrameworkCore.ClickHouse/Design/Internal/ClickHouseAnnotationCodeGenerator.cs @@ -295,7 +295,7 @@ public override IReadOnlyList GenerateFluentApiCalls(IEn return fragments; } - private static T? GetAndRemove(IDictionary annotations, string annotationName) + private static T GetAndRemove(IDictionary annotations, string annotationName) { if (annotations.TryGetValue(annotationName, out var annotation) && annotation.Value != null) diff --git a/src/EntityFrameworkCore.ClickHouse/Query/Expressions/Internal/ClickHouseRowValueExpression.cs b/src/EntityFrameworkCore.ClickHouse/Query/Expressions/Internal/ClickHouseRowValueExpression.cs index e4d7ec2..bcf3648 100644 --- a/src/EntityFrameworkCore.ClickHouse/Query/Expressions/Internal/ClickHouseRowValueExpression.cs +++ b/src/EntityFrameworkCore.ClickHouse/Query/Expressions/Internal/ClickHouseRowValueExpression.cs @@ -11,9 +11,9 @@ namespace ClickHouse.EntityFrameworkCore.Query.Expressions.Internal; public class ClickHouseRowValueExpression : SqlExpression, IEquatable { - private static ConstructorInfo? _quotingConstructor; + private static ConstructorInfo _quotingConstructor; - public ClickHouseRowValueExpression(IReadOnlyList values, Type type, RelationalTypeMapping? typeMapping = null) + public ClickHouseRowValueExpression(IReadOnlyList values, Type type, RelationalTypeMapping typeMapping = null) : base(type, typeMapping) { Values = values; @@ -23,7 +23,7 @@ public ClickHouseRowValueExpression(IReadOnlyList values, Type ty protected override Expression VisitChildren(ExpressionVisitor visitor) { - SqlExpression[]? newRowValues = null; + SqlExpression[] newRowValues = null; for (var i = 0; i < Values.Count; i++) { @@ -78,10 +78,10 @@ protected override void Print(ExpressionPrinter expressionPrinter) expressionPrinter.Append(")"); } - public override bool Equals(object? obj) + public override bool Equals(object obj) => obj is ClickHouseRowValueExpression other && Equals(other); - public virtual bool Equals(ClickHouseRowValueExpression? other) + public virtual bool Equals(ClickHouseRowValueExpression other) { if (other is null || !base.Equals(other) || other.Values.Count != Values.Count) { diff --git a/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseSqlNullabilityProcessor.cs b/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseSqlNullabilityProcessor.cs index 38120fa..e68b849 100644 --- a/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseSqlNullabilityProcessor.cs +++ b/src/EntityFrameworkCore.ClickHouse/Query/Internal/ClickHouseSqlNullabilityProcessor.cs @@ -183,7 +183,7 @@ protected virtual SqlExpression VisitRowValueExpression( bool allowOptimizedExpansion, out bool nullable) { - SqlExpression[]? newValues = null; + SqlExpression[] newValues = null; for (var i = 0; i < rowValueExpression.Values.Count; i++) { diff --git a/src/EntityFrameworkCore.ClickHouse/Storage/Internal/ClickHouseTypeMappingSource.cs b/src/EntityFrameworkCore.ClickHouse/Storage/Internal/ClickHouseTypeMappingSource.cs index d7ebf3a..0f2ad6e 100644 --- a/src/EntityFrameworkCore.ClickHouse/Storage/Internal/ClickHouseTypeMappingSource.cs +++ b/src/EntityFrameworkCore.ClickHouse/Storage/Internal/ClickHouseTypeMappingSource.cs @@ -217,7 +217,7 @@ public ClickHouseTypeMappingSource(TypeMappingSourceDependencies dependencies, R private RelationalTypeMapping? FindDecimalMapping(in RelationalTypeMappingInfo mappingInfo) { return mappingInfo.ClrType == typeof(decimal) || mappingInfo.StoreTypeNameBase == "Decimal" - ? new ClickHouseDecimalTypeMapping(mappingInfo.Precision, mappingInfo.Scale, mappingInfo.Size) + ? new ClickHouseDecimalTypeMapping(mappingInfo.Precision, mappingInfo.Scale) : null; } diff --git a/src/EntityFrameworkCore.ClickHouse/Storage/Internal/Mapping/ClickHouseDecimalTypeMapping.cs b/src/EntityFrameworkCore.ClickHouse/Storage/Internal/Mapping/ClickHouseDecimalTypeMapping.cs index c9a0f9c..e2044a2 100644 --- a/src/EntityFrameworkCore.ClickHouse/Storage/Internal/Mapping/ClickHouseDecimalTypeMapping.cs +++ b/src/EntityFrameworkCore.ClickHouse/Storage/Internal/Mapping/ClickHouseDecimalTypeMapping.cs @@ -1,3 +1,4 @@ +using ClickHouse.Driver.ADO.Parameters; using ClickHouse.EntityFrameworkCore.Storage.ValueConversation; using Microsoft.EntityFrameworkCore.Storage; using System; @@ -9,18 +10,18 @@ namespace ClickHouse.EntityFrameworkCore.Storage.Internal.Mapping; public class ClickHouseDecimalTypeMapping : DecimalTypeMapping { - private const byte DefaultPrecision = 36; - private const byte DefaultScale = 24; + private const byte DefaultPrecision = 38; + private const byte DefaultScale = 19; - public ClickHouseDecimalTypeMapping(int? precision, int? scale, int? size) : + public ClickHouseDecimalTypeMapping(int? precision, int? scale) : base( new RelationalTypeMappingParameters( new CoreTypeMappingParameters(typeof(decimal), new ClickHouseDecimalValueConverter()), - GetStoreType(precision ?? DefaultPrecision, scale ?? DefaultScale), - StoreTypePostfix.None, + "Decimal", + StoreTypePostfix.PrecisionAndScale, System.Data.DbType.Decimal, - false, - size)) + precision: precision ?? DefaultPrecision, + scale: scale ?? DefaultScale)) { } @@ -35,14 +36,11 @@ protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters p protected override void ConfigureParameter(DbParameter parameter) { - var clickHouseParameter = (Driver.ADO.Parameters.ClickHouseDbParameter)parameter; - clickHouseParameter.Precision = (byte)(Precision ?? DefaultPrecision); - clickHouseParameter.Scale = (byte)(Scale ?? DefaultScale); - clickHouseParameter.ClickHouseType = GetStoreType(parameter.Value); + parameter.Precision = (byte)(Precision ?? DefaultPrecision); + parameter.Scale = (byte)(Scale ?? DefaultScale); + ((ClickHouseDbParameter)parameter).ClickHouseType = GetStoreType(parameter.Value); } - private static string GetStoreType(int precision, int scale) => $"Decimal({precision}, {scale})"; - public override MethodInfo GetDataReaderMethod() { return typeof(DbDataReader).GetRuntimeMethod(nameof(DbDataReader.GetValue), [typeof(int)])!; @@ -55,7 +53,7 @@ public override Expression CustomizeDataReaderExpression(Expression expression) expression ); } - + protected virtual string GetStoreType(bool? isNullable) { return isNullable == true ? $"Nullable({StoreType})" : StoreType; @@ -65,4 +63,9 @@ protected virtual string GetStoreType(object? parameterValue) { return GetStoreType(parameterValue == null || parameterValue == DBNull.Value); } + + protected override string GenerateNonNullSqlLiteral(object value) + { + return base.GenerateNonNullSqlLiteral(value) + "::" + StoreType; + } } diff --git a/src/EntityFrameworkCore.ClickHouse/Storage/Json/JsonInt128ReaderWriter.cs b/src/EntityFrameworkCore.ClickHouse/Storage/Json/JsonInt128ReaderWriter.cs index 494def2..9915340 100644 --- a/src/EntityFrameworkCore.ClickHouse/Storage/Json/JsonInt128ReaderWriter.cs +++ b/src/EntityFrameworkCore.ClickHouse/Storage/Json/JsonInt128ReaderWriter.cs @@ -19,7 +19,7 @@ private JsonInt128ReaderWriter() { } - public override Int128 FromJsonTyped(ref Utf8JsonReaderManager manager, object? existingObject = null) + public override Int128 FromJsonTyped(ref Utf8JsonReaderManager manager, object existingObject = null) { var reader = manager.CurrentReader; diff --git a/src/EntityFrameworkCore.ClickHouse/Storage/Json/JsonUInt128ReaderWriter.cs b/src/EntityFrameworkCore.ClickHouse/Storage/Json/JsonUInt128ReaderWriter.cs index 183c261..063f836 100644 --- a/src/EntityFrameworkCore.ClickHouse/Storage/Json/JsonUInt128ReaderWriter.cs +++ b/src/EntityFrameworkCore.ClickHouse/Storage/Json/JsonUInt128ReaderWriter.cs @@ -19,7 +19,7 @@ private JsonUInt128ReaderWriter() { } - public override UInt128 FromJsonTyped(ref Utf8JsonReaderManager manager, object? existingObject = null) + public override UInt128 FromJsonTyped(ref Utf8JsonReaderManager manager, object existingObject = null) { var reader = manager.CurrentReader; diff --git a/test/EntityFrameworkCore.ClickHouse.FunctionalTests/Query/ArithmeticDbFunctionsExtensionsClickHouseTest.cs b/test/EntityFrameworkCore.ClickHouse.FunctionalTests/Query/ArithmeticDbFunctionsExtensionsClickHouseTest.cs index e440855..96383f0 100644 --- a/test/EntityFrameworkCore.ClickHouse.FunctionalTests/Query/ArithmeticDbFunctionsExtensionsClickHouseTest.cs +++ b/test/EntityFrameworkCore.ClickHouse.FunctionalTests/Query/ArithmeticDbFunctionsExtensionsClickHouseTest.cs @@ -37,6 +37,29 @@ SELECT divide("o"."UnitPrice", "o"."Discount") AS "Double" """); } + [Fact] + public async Task DivideDecimal() + { + var context = CreateContext(); + + await context.OrderDetails + .Where(e => e.OrderID == 10285) + .Select(e => new + { + DecimalDivide = decimal.Divide(e.UnitPrice, 10m), + DivideDecimal = EF.Functions.DivideDecimal(e.UnitPrice, 10m), + DivideDecimalWithPrecision = EF.Functions.DivideDecimal(e.UnitPrice, 10m, 10) + }) + .ToArrayAsync(); + + AssertSql( + """ + SELECT divideDecimal("o"."UnitPrice", 10::Decimal(38,19)) AS "DecimalDivide", divideDecimal("o"."UnitPrice", 10::Decimal(38,19), 10) AS "DivideDecimalWithPrecision" + FROM "OrderDetails" AS "o" + WHERE "o"."OrderID" = 10285 + """); + } + protected NorthwindQueryClickHouseFixture Fixture { get; } private void AssertSql(params string[] expected) diff --git a/test/EntityFrameworkCore.ClickHouse.FunctionalTests/Query/TypeConversionTest.cs b/test/EntityFrameworkCore.ClickHouse.FunctionalTests/Query/TypeConversionTest.cs index 0ccdc93..55875d5 100644 --- a/test/EntityFrameworkCore.ClickHouse.FunctionalTests/Query/TypeConversionTest.cs +++ b/test/EntityFrameworkCore.ClickHouse.FunctionalTests/Query/TypeConversionTest.cs @@ -1383,7 +1383,7 @@ await context.TypeConversions AssertSql( """ - SELECT toDecimal32OrDefault("t"."Int8AsStringValid", 2, toDecimal32(42, 2)) AS "ToDecimal32OrDefault" + SELECT toDecimal32OrDefault("t"."Int8AsStringValid", 2, toDecimal32(42::Decimal(38,19), 2)) AS "ToDecimal32OrDefault" FROM "TypeConversions" AS "t" """); } @@ -1478,7 +1478,7 @@ await context.TypeConversions AssertSql( """ - SELECT toDecimal64OrDefault("t"."Int16AsStringValid", 2, toDecimal64(42, 2)) AS "ToDecimal64OrDefault" + SELECT toDecimal64OrDefault("t"."Int16AsStringValid", 2, toDecimal64(42::Decimal(38,19), 2)) AS "ToDecimal64OrDefault" FROM "TypeConversions" AS "t" """); } @@ -1572,10 +1572,10 @@ await context.TypeConversions .ToArrayAsync(); AssertSql( - """ - SELECT toDecimal128OrDefault("t"."Int32AsStringValid", 2, toDecimal128(42, 2)) AS "ToDecimal128OrDefault" - FROM "TypeConversions" AS "t" - """); + """ + SELECT toDecimal128OrDefault("t"."Int32AsStringValid", 2, toDecimal128(42::Decimal(38,19), 2)) AS "ToDecimal128OrDefault" + FROM "TypeConversions" AS "t" + """); } [Fact] @@ -1668,7 +1668,7 @@ await context.TypeConversions AssertSql( """ - SELECT toDecimal256OrDefault("t"."Int64AsStringValid", 2, toDecimal256(42, 2)) AS "ToDecimal256OrDefault" + SELECT toDecimal256OrDefault("t"."Int64AsStringValid", 2, toDecimal256(42::Decimal(38,19), 2)) AS "ToDecimal256OrDefault" FROM "TypeConversions" AS "t" """); }