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/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs index 879b0d0..71a4ba8 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseArithmeticDbFunctionsExtensions.cs @@ -11,9 +11,9 @@ public static class ClickHouseArithmeticDbFunctionsExtensions /// The result type is always double. /// Integer division is provided by the intDiv function. /// - /// DbFunctions instance. /// Dividend. /// Divisor + /// DbFunctions instance. /// /// /// The quotient of x and y. diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs index 50eea5a..a05efd5 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseBoolDbFunctionsExtensions.cs @@ -9,8 +9,8 @@ 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. + /// 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 _, string expr) @@ -21,8 +21,8 @@ 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. /// - /// DbFunctions instance. /// 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 diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs index 21d7088..6870428 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDate32DbFunctionsExtensions.cs @@ -9,8 +9,8 @@ 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. + /// DbFunctions instance. /// Returns a calendar date. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -25,8 +25,8 @@ 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 /// - /// DbFunctions instance. /// 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. @@ -40,8 +40,8 @@ public static DateOnly ToDate32(this DbFunctions _, uint expr) /// /// The same as but returns the min value of Date32 if an invalid argument is received. /// - /// DbFunctions instance. /// 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. @@ -55,8 +55,8 @@ public static DateOnly ToDate32OrZero(this DbFunctions _, string? expr) /// /// The same as but returns null if an invalid argument is received. /// - /// DbFunctions instance. /// The value to convert. + /// DbFunctions instance. /// /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -66,15 +66,15 @@ public static DateOnly ToDate32OrZero(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. + /// DbFunctions instance. /// Returns a calendar date. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -91,9 +91,9 @@ public static DateOnly ToDate32OrDefault(this DbFunctions _, string? expr) /// 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. /// + /// DbFunctions instance. /// Returns a calendar date. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs index 2861729..574e1e3 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateDbFunctionsExtensions.cs @@ -9,8 +9,8 @@ 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. + /// DbFunctions instance. /// /// Returns the converted input value. /// @@ -25,8 +25,8 @@ public static DateOnly ToDate(this DbFunctions _, TNumber expr) where T /// /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. /// - /// DbFunctions instance. /// 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. @@ -40,8 +40,8 @@ public static DateOnly ToDate(this DbFunctions _, string? expr) /// /// Converts an input value to type Date. Supports conversion from String, FixedString, DateTime, or numeric types. /// - /// DbFunctions instance. /// 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. @@ -55,9 +55,9 @@ public static DateOnly ToDate(this DbFunctions _, DateTime expr) /// /// 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. + /// DbFunctions instance. /// /// Returns the converted input value. /// @@ -72,9 +72,9 @@ public static DateOnly ToDate(this DbFunctions _, TNumber expr, string /// /// 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. + /// DbFunctions instance. /// Returns the converted input value. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -88,9 +88,9 @@ public static DateOnly ToDate(this DbFunctions _, string? expr, string timeZone) /// /// 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. + /// DbFunctions instance. /// Returns the converted input value. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -105,8 +105,8 @@ public static DateOnly ToDate(this DbFunctions _, DateTime expr, string timeZone /// 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. + /// DbFunctions instance. /// Returns the converted input value. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -121,8 +121,8 @@ public static DateOnly ToDateOrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// Returns the converted input value. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -137,8 +137,8 @@ public static DateOnly ToDateOrZero(this DbFunctions _, string? expr) /// 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. + /// 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. @@ -152,9 +152,9 @@ public static DateOnly ToDateOrDefault(this DbFunctions _, string? expr) /// 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. + /// 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. diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs index b8a691b..4ec3315 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTime64DbFunctionsExtensions.cs @@ -9,9 +9,9 @@ public static class ClickHouseDateTime64DbFunctionsExtensions /// /// Converts an input value to a value of type DateTime64. /// - /// DbFunctions instance. /// 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 /// @@ -25,10 +25,10 @@ public static DateTime ToDateTime64(this DbFunctions _, string expr, [Range(0, 9 /// /// Converts an input value to a value of type DateTime64. /// - /// DbFunctions instance. /// 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 /// @@ -42,9 +42,9 @@ public static DateTime ToDateTime64(this DbFunctions _, string expr, [Range(0, 9 /// /// Converts an input value to a value of type DateTime64. /// - /// DbFunctions instance. /// 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 /// @@ -58,10 +58,10 @@ public static DateTime ToDateTime64(this DbFunctions _, uint expr, [Range(0, 9)] /// /// Converts an input value to a value of type DateTime64. /// - /// DbFunctions instance. /// 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 /// @@ -75,9 +75,9 @@ public static DateTime ToDateTime64(this DbFunctions _, uint expr, [Range(0, 9)] /// /// Converts an input value to a value of type DateTime64. /// - /// DbFunctions instance. /// 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 /// @@ -91,10 +91,10 @@ public static DateTime ToDateTime64(this DbFunctions _, DateOnly expr, [Range(0, /// /// Converts an input value to a value of type DateTime64. /// - /// DbFunctions instance. /// 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 /// @@ -108,9 +108,9 @@ public static DateTime ToDateTime64(this DbFunctions _, DateOnly expr, [Range(0, /// /// Converts an input value to a value of type DateTime64. /// - /// DbFunctions instance. /// 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 /// @@ -124,10 +124,10 @@ public static DateTime ToDateTime64(this DbFunctions _, float expr, [Range(0, 9) /// /// Converts an input value to a value of type DateTime64. /// - /// DbFunctions instance. /// 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 /// @@ -142,9 +142,9 @@ public static DateTime ToDateTime64(this DbFunctions _, float expr, [Range(0, 9) /// 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). + /// 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. @@ -158,10 +158,10 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, string expr, [Rang /// 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. + /// 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. @@ -175,9 +175,9 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, string expr, [Rang /// 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). + /// 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. @@ -191,10 +191,10 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, uint expr, [Range( /// 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. + /// 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. @@ -208,9 +208,9 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, uint expr, [Range( /// 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). + /// 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. @@ -224,10 +224,10 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, DateTime expr, [Ra /// 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. + /// 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. @@ -241,9 +241,9 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, DateTime expr, [Ra /// 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). + /// 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. @@ -257,10 +257,10 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range /// 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. + /// 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. @@ -274,9 +274,9 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range /// 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). + /// 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. @@ -289,10 +289,10 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range /// 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. + /// 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. @@ -305,9 +305,9 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range /// 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). + /// 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. @@ -320,10 +320,10 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range /// 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. + /// 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. @@ -336,9 +336,9 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range /// 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). + /// 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. @@ -351,10 +351,10 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range /// 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. + /// 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. @@ -362,14 +362,14 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range { 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). + /// 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. @@ -382,10 +382,10 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range /// 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. + /// 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. @@ -400,9 +400,9 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range /// 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). + /// 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. @@ -418,10 +418,10 @@ public static DateTime ToDateTime64OrZero(this DbFunctions _, float expr, [Range /// 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. + /// 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. @@ -437,9 +437,9 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, string expr, [R /// 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). + /// 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. @@ -455,10 +455,10 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Ran /// 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. + /// 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. @@ -474,9 +474,9 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Ran /// 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). + /// 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. @@ -492,10 +492,10 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, /// 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. + /// 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. @@ -505,15 +505,15 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, { 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). + /// 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. @@ -529,10 +529,10 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Ra /// 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. + /// 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. @@ -548,10 +548,10 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Ra /// 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. + /// 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. @@ -567,11 +567,11 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Ra /// 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. + /// 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. @@ -587,10 +587,10 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, string expr, [R /// 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. + /// 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. @@ -606,11 +606,11 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Ran /// 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. + /// 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. @@ -626,10 +626,10 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, uint expr, [Ran /// 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. + /// 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. @@ -645,11 +645,11 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, /// 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. + /// 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. @@ -665,10 +665,10 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, DateTime expr, /// 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. + /// 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. @@ -684,11 +684,11 @@ public static DateTime ToDateTime64OrDefault(this DbFunctions _, float expr, [Ra /// 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. + /// 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. diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs index 12d1c1e..18b7993 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDateTimeDbFunctionsExtensions.cs @@ -9,8 +9,8 @@ public static class ClickHouseDateTimeDbFunctionsExtensions /// /// Converts an input value to type DateTime. /// - /// DbFunctions instance. /// The value. + /// DbFunctions instance. /// /// Returns a date time. /// @@ -25,8 +25,8 @@ public static DateTime ToDateTime(this DbFunctions _, TNumber expr) whe /// /// Converts an input value to type DateTime. /// - /// DbFunctions instance. /// The value. + /// DbFunctions instance. /// Returns a date time. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -40,8 +40,8 @@ public static DateTime ToDateTime(this DbFunctions _, string? expr) /// /// Converts an input value to type DateTime. /// - /// DbFunctions instance. /// The value. + /// DbFunctions instance. /// Returns a date time. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -55,9 +55,9 @@ public static DateTime ToDateTime(this DbFunctions _, DateOnly expr) /// /// Converts an input value to type DateTime. /// - /// DbFunctions instance. /// 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. @@ -71,9 +71,9 @@ public static DateTime ToDateTime(this DbFunctions _, TNumber expr, str /// /// Converts an input value to type DateTime. /// - /// DbFunctions instance. /// 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. @@ -87,9 +87,9 @@ public static DateTime ToDateTime(this DbFunctions _, string? expr, string timeZ /// /// Converts an input value to type DateTime. /// - /// DbFunctions instance. /// 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. @@ -105,8 +105,8 @@ public static DateTime ToDateTime(this DbFunctions _, DateOnly expr, string time /// 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. + /// DbFunctions instance. /// Returns a date time. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -121,8 +121,8 @@ public static DateTime ToDateTimeOrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// Returns a date time. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -137,8 +137,8 @@ public static DateTime ToDateTimeOrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// Returns a date time. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -153,9 +153,9 @@ public static DateTime ToDateTimeOrDefault(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// Returns a date time. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -170,10 +170,10 @@ public static DateTime ToDateTimeOrDefault(this DbFunctions _, string? expr, str /// 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. + /// DbFunctions instance. /// Returns a date time. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs index 8997e72..251b6ae 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal128DbFunctionsExtensions.cs @@ -10,9 +10,9 @@ 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. + /// DbFunctions instance. /// public static decimal ToDecimal128(this DbFunctions _, string number, [Range(0, 38)] byte scale) { @@ -22,9 +22,9 @@ public static decimal ToDecimal128(this DbFunctions _, string number, [Range(0, /// /// 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. + /// DbFunctions instance. /// public static decimal ToDecimal128(this DbFunctions _, TNumber number, [Range(0, 38)] byte scale) where TNumber : INumber { @@ -34,9 +34,9 @@ public static decimal ToDecimal128(this DbFunctions _, TNumber number, /// /// 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. + /// DbFunctions instance. /// public static decimal ToDecimal128OrZero(this DbFunctions _, string? number, [Range(0, 38)] byte scale) { @@ -47,9 +47,9 @@ public static decimal ToDecimal128OrZero(this DbFunctions _, string? number, [Ra /// 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. + /// DbFunctions instance. /// /// public static decimal? ToDecimal128OrNull(this DbFunctions _, string? number, [Range(0, 38)] byte scale) @@ -60,9 +60,9 @@ public static decimal ToDecimal128OrZero(this DbFunctions _, string? number, [Ra /// /// 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. + /// DbFunctions instance. /// public static decimal ToDecimal128OrDefault(this DbFunctions _, string? number, [Range(0, 38)] byte scale) { @@ -72,10 +72,10 @@ public static decimal ToDecimal128OrDefault(this DbFunctions _, string? number, /// /// 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. /// + /// DbFunctions instance. /// public static decimal ToDecimal128OrDefault(this DbFunctions _, string? number, [Range(0, 38)] byte scale, decimal defaultValue) { diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs index 6d7b189..2453801 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal256DbFunctionsExtensions.cs @@ -10,9 +10,9 @@ 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. + /// DbFunctions instance. /// public static decimal ToDecimal256(this DbFunctions _, string number, [Range(0, 76)] byte scale) { @@ -22,9 +22,9 @@ public static decimal ToDecimal256(this DbFunctions _, string number, [Range(0, /// /// 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. + /// DbFunctions instance. /// public static decimal ToDecimal256(this DbFunctions _, TNumber number, [Range(0, 76)] byte scale) where TNumber : INumber { @@ -34,9 +34,9 @@ public static decimal ToDecimal256(this DbFunctions _, TNumber number, /// /// 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. + /// DbFunctions instance. /// /// public static decimal ToDecimal256OrZero(this DbFunctions _, string? number, [Range(0, 76)] byte scale) @@ -47,9 +47,9 @@ public static decimal ToDecimal256OrZero(this DbFunctions _, string? number, [Ra /// /// 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. + /// DbFunctions instance. /// public static decimal? ToDecimal256OrNull(this DbFunctions _, string? number, [Range(0, 76)] byte scale) { @@ -59,9 +59,9 @@ public static decimal ToDecimal256OrZero(this DbFunctions _, string? number, [Ra /// /// 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. + /// DbFunctions instance. /// public static decimal? ToDecimal256OrDefault(this DbFunctions _, string? number, [Range(0, 76)] byte scale) { @@ -71,13 +71,46 @@ public static decimal ToDecimal256OrZero(this DbFunctions _, string? number, [Ra /// /// 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. + /// 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. + /// 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. + /// 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 6b49c13..7072d92 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal32DbFunctionsExtensions.cs @@ -11,9 +11,9 @@ 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. + /// DbFunctions instance. /// public static decimal ToDecimal32(this DbFunctions _, string number, [Range(0, 9)] byte scale) { @@ -24,9 +24,9 @@ public static decimal ToDecimal32(this DbFunctions _, string number, [Range(0, 9 /// 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. + /// DbFunctions instance. /// public static decimal ToDecimal32(this DbFunctions _, TNumber number, [Range(0, 9)] byte scale) where TNumber: INumber { @@ -37,9 +37,9 @@ public static decimal ToDecimal32(this DbFunctions _, TNumber number, [ /// 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. + /// DbFunctions instance. /// public static decimal ToDecimal32OrZero(this DbFunctions _, string? number, [Range(0, 9)] byte scale) { @@ -50,9 +50,9 @@ public static decimal ToDecimal32OrZero(this DbFunctions _, string? number, [Ran /// 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. + /// DbFunctions instance. /// public static decimal? ToDecimal32OrNull(this DbFunctions _, string? number, [Range(0, 9)] byte scale) { @@ -63,9 +63,9 @@ public static decimal ToDecimal32OrZero(this DbFunctions _, string? number, [Ran /// 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. + /// DbFunctions instance. /// /// public static decimal ToDecimal32OrDefault(this DbFunctions _, string? number, [Range(0, 9)] byte scale) @@ -77,10 +77,10 @@ public static decimal ToDecimal32OrDefault(this DbFunctions _, string? number, [ /// 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. /// + /// DbFunctions instance. /// public static decimal ToDecimal32OrDefault(this DbFunctions _, string? number, [Range(0, 9)] byte scale, decimal defaultValue) { diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs index b692771..2c53e4f 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseDecimal64DbFunctionsExtensions.cs @@ -10,9 +10,9 @@ 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. + /// DbFunctions instance. /// public static decimal ToDecimal64(this DbFunctions _, string number, [Range(0, 18)] byte scale) { @@ -22,9 +22,9 @@ public static decimal ToDecimal64(this DbFunctions _, string number, [Range(0, 1 /// /// 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. + /// DbFunctions instance. /// public static decimal ToDecimal64(this DbFunctions _, TNumber number, [Range(0, 18)] byte scale) where TNumber : INumber { @@ -35,9 +35,9 @@ public static decimal ToDecimal64(this DbFunctions _, TNumber number, [ /// 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. + /// DbFunctions instance. /// public static decimal ToDecimal64OrZero(this DbFunctions _, string? number, [Range(0, 18)] byte scale) { @@ -48,9 +48,9 @@ public static decimal ToDecimal64OrZero(this DbFunctions _, string? number, [Ran /// 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. + /// DbFunctions instance. /// public static decimal? ToDecimal64OrNull(this DbFunctions _, string? number, [Range(0, 18)] byte scale) { @@ -60,9 +60,9 @@ public static decimal ToDecimal64OrZero(this DbFunctions _, string? number, [Ran /// /// 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. + /// DbFunctions instance. /// public static decimal ToDecimal64OrDefault(this DbFunctions _, string? number, [Range(0, 18)] byte scale) { @@ -72,10 +72,10 @@ public static decimal ToDecimal64OrDefault(this DbFunctions _, string? number, [ /// /// 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. /// + /// DbFunctions instance. /// public static decimal ToDecimal64OrDefault(this DbFunctions _, string? number, [Range(0, 18)] byte scale, decimal defaultValue) { diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs index 924eeb8..502de17 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat32DbFunctionsExtensions.cs @@ -9,8 +9,8 @@ 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. + /// DbFunctions instance. /// /// 32-bit floating point value. /// @@ -25,8 +25,8 @@ public static float ToFloat32(this DbFunctions _, TNumber expr) where T /// /// 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. + /// DbFunctions instance. /// 32-bit floating point value. /// /// is only intended for use via SQL translation as part of an EF Core LINQ query. @@ -41,8 +41,8 @@ public static float ToFloat32(this DbFunctions _, string? expr) /// 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. + /// 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. @@ -57,8 +57,8 @@ public static float ToFloat32OrZero(this DbFunctions _, string? expr) /// 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. + /// 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. @@ -74,8 +74,8 @@ public static float ToFloat32OrZero(this DbFunctions _, string? expr) /// 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. + /// 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. @@ -91,9 +91,9 @@ public static float ToFloat32OrDefault(this DbFunctions _, string? expr) /// 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. + /// 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. diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs index 6dfd5a3..be004bb 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseFloat64DbFunctionsExtensions.cs @@ -9,8 +9,8 @@ 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. + /// DbFunctions instance. /// /// Returns a 64-bit floating point value. /// @@ -25,8 +25,8 @@ public static double ToFloat64(this DbFunctions _, TNumber expr) where /// /// 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. + /// DbFunctions instance. /// Returns a 64-bit floating point value. /// /// is used for converting string representations of numbers to Float64. @@ -41,8 +41,8 @@ public static double ToFloat64(this DbFunctions _, string? expr) /// 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. + /// 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. @@ -57,8 +57,8 @@ public static double ToFloat64OrZero(this DbFunctions _, string? expr) /// 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. + /// 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. @@ -74,8 +74,8 @@ public static double ToFloat64OrZero(this DbFunctions _, string? expr) /// 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. + /// 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. @@ -91,8 +91,8 @@ public static double ToFloat64OrDefault(this DbFunctions _, string? expr) /// 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. + /// 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. diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs index e6ff7aa..2f26dff 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt128DbFunctionsExtensions.cs @@ -9,8 +9,8 @@ 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. + /// DbFunctions instance. /// /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128 @@ -22,8 +22,8 @@ public static Int128 ToInt128(this DbFunctions _, TNumber expr) where T /// /// 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. + /// DbFunctions instance. /// /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128 @@ -36,8 +36,8 @@ public static Int128 ToInt128(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128orzero public static Int128 ToInt128OrZero(this DbFunctions _, string? expr) @@ -49,8 +49,8 @@ public static Int128 ToInt128OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ornull public static Int128? ToInt128OrNull(this DbFunctions _, string? expr) @@ -62,8 +62,8 @@ public static Int128 ToInt128OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ordefault public static Int128 ToInt128OrDefault(this DbFunctions _, string? expr) @@ -75,9 +75,9 @@ public static Int128 ToInt128OrDefault(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint128ordefault public static Int128 ToInt128OrDefault(this DbFunctions _, string? expr, Int128 defaultValue) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs index bba7843..cff974a 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt16DbFunctionsExtensions.cs @@ -9,8 +9,8 @@ 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16 public static short ToInt16(this DbFunctions _, TNumber expr) where TNumber : INumber @@ -21,8 +21,8 @@ public static short ToInt16(this DbFunctions _, TNumber expr) where TNu /// /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16 public static short ToInt16(this DbFunctions _, string? expr) @@ -34,8 +34,8 @@ public static short ToInt16(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// public static short ToInt16OrZero(this DbFunctions _, string? expr) @@ -47,8 +47,8 @@ public static short ToInt16OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ornull public static short? ToInt16OrNull(this DbFunctions _, string? expr) @@ -60,8 +60,8 @@ public static short ToInt16OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ordefault public static short ToInt16OrDefault(this DbFunctions _, string? expr) @@ -73,9 +73,9 @@ public static short ToInt16OrDefault(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint16ordefault public static short ToInt16OrDefault(this DbFunctions _, string? expr, short defaultValue) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs index 1275a56..dd54c40 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt32DbFunctionsExtensions.cs @@ -9,8 +9,8 @@ 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. + /// DbFunctions instance. /// /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32 @@ -22,8 +22,8 @@ public static int ToInt32(this DbFunctions _, TNumber expr) where TNumb /// /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32 public static int ToInt32(this DbFunctions _, string? expr) @@ -35,8 +35,8 @@ public static int ToInt32(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32orzero public static int ToInt32OrZero(this DbFunctions _, string? expr) @@ -48,8 +48,8 @@ public static int ToInt32OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ornull public static int? ToInt32OrNull(this DbFunctions _, string? expr) @@ -62,8 +62,8 @@ public static int ToInt32OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ordefault public static int ToInt32OrDefault(this DbFunctions _, string? expr) @@ -76,9 +76,9 @@ public static int ToInt32OrDefault(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint32ordefault public static int ToInt32OrDefault(this DbFunctions _, string? expr, int defaultValue) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs index 6bcd1cb..97d640e 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt64DbFunctionsExtensions.cs @@ -9,8 +9,8 @@ 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. + /// DbFunctions instance. /// /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64 @@ -22,8 +22,8 @@ public static long ToInt64(this DbFunctions _, TNumber expr) where TNum /// /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64 public static long ToInt64(this DbFunctions _, string? expr) @@ -35,8 +35,8 @@ public static long ToInt64(this DbFunctions _, string? expr) /// 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 + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64orzero public static long ToInt64OrZero(this DbFunctions _, string? expr) @@ -48,8 +48,8 @@ public static long ToInt64OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ornull public static long? ToInt64OrNull(this DbFunctions _, string? expr) @@ -62,8 +62,8 @@ public static long ToInt64OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ordefault public static long ToInt64OrDefault(this DbFunctions _, string? expr) @@ -76,9 +76,9 @@ public static long ToInt64OrDefault(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint64ordefault public static long ToInt64OrDefault(this DbFunctions _, string? expr, long defaultValue) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs index 4b2ffe7..f89e233 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseInt8DbFunctionsExtensions.cs @@ -9,8 +9,8 @@ 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. + /// DbFunctions instance. /// /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8 @@ -22,8 +22,8 @@ public static sbyte ToInt8(this DbFunctions _, TNumber expr) where TNum /// /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8 public static sbyte ToInt8(this DbFunctions _, string? expr) @@ -34,8 +34,8 @@ public static sbyte ToInt8(this DbFunctions _, string? expr) /// /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toint8orzero public static sbyte ToInt8OrZero(this DbFunctions _, string? expr) @@ -47,8 +47,8 @@ public static sbyte ToInt8OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toInt8OrNull public static sbyte? ToInt8OrNull(this DbFunctions _, string? expr) @@ -61,8 +61,8 @@ public static sbyte ToInt8OrZero(this DbFunctions _, string? expr) /// 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) @@ -75,9 +75,9 @@ public static sbyte ToInt8OrDefault(this DbFunctions _, string? expr) /// 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) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs index 7d1fc1c..914acbc 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt128DbFunctionsExtensions.cs @@ -10,8 +10,8 @@ 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. + /// DbFunctions instance. /// /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128 @@ -24,8 +24,8 @@ public static UInt128 ToUInt128(this DbFunctions _, TNumber expr) where /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt128 public static UInt128 ToUInt128(this DbFunctions _, string? expr) @@ -37,8 +37,8 @@ public static UInt128 ToUInt128(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// public static UInt128 ToUInt128OrZero(this DbFunctions _, string? expr) { @@ -49,8 +49,8 @@ public static UInt128 ToUInt128OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// public static UInt128? ToUInt128OrNull(this DbFunctions _, string? expr) { @@ -62,8 +62,8 @@ public static UInt128 ToUInt128OrZero(this DbFunctions _, string? expr) /// 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) @@ -76,9 +76,9 @@ public static UInt128 ToUInt128OrDefault(this DbFunctions _, string? expr) /// 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) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs index 0bd31ed..1c1adb1 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt16DbFunctionsExtensions.cs @@ -10,8 +10,8 @@ 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. + /// DbFunctions instance. /// /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16 @@ -24,8 +24,8 @@ public static ushort ToUInt16(this DbFunctions _, TNumber expr) where T /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt16 public static ushort ToUInt16(this DbFunctions _, string? expr) @@ -37,8 +37,8 @@ public static ushort ToUInt16(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// public static ushort ToUInt16OrZero(this DbFunctions _, string? expr) { @@ -49,8 +49,8 @@ public static ushort ToUInt16OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// public static ushort? ToUInt16OrNull(this DbFunctions _, string? expr) { @@ -62,8 +62,8 @@ public static ushort ToUInt16OrZero(this DbFunctions _, string? expr) /// 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) @@ -76,9 +76,9 @@ public static ushort ToUInt16OrDefault(this DbFunctions _, string? expr) /// 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) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs index b7df98c..c40b6ac 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt32DbFunctionsExtensions.cs @@ -10,8 +10,8 @@ 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. + /// DbFunctions instance. /// /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32 @@ -24,8 +24,8 @@ public static uint ToUInt32(this DbFunctions _, TNumber expr) where TNu /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt32 public static uint ToUInt32(this DbFunctions _, string? expr) @@ -37,8 +37,8 @@ public static uint ToUInt32(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// public static uint ToUInt32OrZero(this DbFunctions _, string? expr) { @@ -49,8 +49,8 @@ public static uint ToUInt32OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// public static uint? ToUInt32OrNull(this DbFunctions _, string? expr) { @@ -62,8 +62,8 @@ public static uint ToUInt32OrZero(this DbFunctions _, string? expr) /// 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) @@ -76,9 +76,9 @@ public static uint ToUInt32OrDefault(this DbFunctions _, string? expr) /// 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) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs index cf85bb4..36dc4ed 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt64DbFunctionsExtensions.cs @@ -10,8 +10,8 @@ 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. + /// DbFunctions instance. /// /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64 @@ -24,8 +24,8 @@ public static ulong ToUInt64(this DbFunctions _, TNumber expr) where TN /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#toUInt64 public static ulong ToUInt64(this DbFunctions _, string? expr) @@ -37,8 +37,8 @@ public static ulong ToUInt64(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// public static ulong ToUInt64OrZero(this DbFunctions _, string? expr) { @@ -49,8 +49,8 @@ public static ulong ToUInt64OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// public static ulong? ToUInt64OrNull(this DbFunctions _, string? expr) { @@ -62,8 +62,8 @@ public static ulong ToUInt64OrZero(this DbFunctions _, string? expr) /// 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) @@ -76,9 +76,9 @@ public static ulong ToUInt64OrDefault(this DbFunctions _, string? expr) /// 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) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs index 2224977..a287945 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUInt8DbFunctionsExtensions.cs @@ -10,8 +10,8 @@ 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. + /// DbFunctions instance. /// /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8 @@ -24,8 +24,8 @@ public static byte ToUInt8(this DbFunctions _, TNumber expr) where TNum /// 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. + /// DbFunctions instance. /// /// https://clickhouse.com/docs/sql-reference/functions/type-conversion-functions#touint8 public static byte ToUInt8(this DbFunctions _, string? expr) @@ -37,8 +37,8 @@ public static byte ToUInt8(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// public static byte ToUInt8OrZero(this DbFunctions _, string? expr) { @@ -49,8 +49,8 @@ public static byte ToUInt8OrZero(this DbFunctions _, string? expr) /// 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. + /// DbFunctions instance. /// public static byte? ToUInt8OrNull(this DbFunctions _, string? expr) { @@ -62,8 +62,8 @@ public static byte ToUInt8OrZero(this DbFunctions _, string? expr) /// 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) @@ -76,9 +76,9 @@ public static byte ToUInt8OrDefault(this DbFunctions _, string? expr) /// 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) diff --git a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs index 477cf66..bcfeafc 100644 --- a/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs +++ b/src/EntityFrameworkCore.ClickHouse/Extensions/DbFunctionsExtensions/ClickHouseUuidDbFunctionsExtensions.cs @@ -8,8 +8,8 @@ public static class ClickHouseUuidDbFunctionsExtensions /// /// Converts a String value to a UUID value. /// - /// DbFunctions instance. /// UUID as a string. + /// DbFunctions instance. /// 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. @@ -25,8 +25,8 @@ public static Guid ToUuid(this DbFunctions _, string? expr) /// 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. + /// 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. @@ -39,8 +39,8 @@ public static Guid ToUuidOrZero(this DbFunctions _, string? expr) /// /// Converts a String value to a UUID value or returns null if the string representation is invalid. /// - /// DbFunctions instance. /// 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. @@ -53,8 +53,8 @@ public static Guid ToUuidOrZero(this DbFunctions _, string? expr) /// /// Converts a String value to a UUID value or returns a default UUID if conversion is not possible. /// - /// DbFunctions instance. /// 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. @@ -67,9 +67,9 @@ public static Guid ToUuidOrDefault(this DbFunctions _, string? expr) /// /// 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. + /// 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. 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/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/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/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" """); } 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)); + } }