Class NpgsqlDbFunctionsExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Npgsql.EntityFrameworkCore.PostgreSQL.dll
Provides Npgsql-specific extension methods on DbFunctions.
public static class NpgsqlDbFunctionsExtensions
- Inheritance
-
NpgsqlDbFunctionsExtensions
- Inherited Members
Methods
Distance(DbFunctions, DateOnly, DateOnly)
Returns the distance between two dates as a number of days, particularly suitable for sorting where the appropriate index is defined.
public static int Distance(this DbFunctions _, DateOnly a, DateOnly b)
Parameters
_DbFunctionsaDateOnlybDateOnly
Returns
Remarks
This requires the btree_gist built-in PostgreSQL extension, see
https://www.postgresql.org/docs/current/btree-gist.html.
Distance(DbFunctions, DateTime, DateTime)
Returns the distance between two timestamps as a PostgreSQL interval, particularly suitable for sorting where the appropriate
index is defined.
public static TimeSpan Distance(this DbFunctions _, DateTime a, DateTime b)
Parameters
_DbFunctionsaDateTimebDateTime
Returns
Remarks
This requires the btree_gist built-in PostgreSQL extension, see
https://www.postgresql.org/docs/current/btree-gist.html.
GreaterThan(DbFunctions, ITuple, ITuple)
Returns whether the row value represented by a is greater than the row value represented by
b.
public static bool GreaterThan(this DbFunctions _, ITuple a, ITuple b)
Parameters
_DbFunctionsaITuplebITuple
Returns
Remarks
For more information on row value comparisons, see the PostgreSQL documentation.
GreaterThanOrEqual(DbFunctions, ITuple, ITuple)
Returns whether the row value represented by a is greater than or equal to the row value represented by
b.
public static bool GreaterThanOrEqual(this DbFunctions _, ITuple a, ITuple b)
Parameters
_DbFunctionsaITuplebITuple
Returns
Remarks
For more information on row value comparisons, see the PostgreSQL documentation.
ILike(DbFunctions, string, string)
An implementation of the PostgreSQL ILIKE operation, which is an insensitive LIKE.
public static bool ILike(this DbFunctions _, string matchExpression, string pattern)
Parameters
_DbFunctionsThe DbFunctions instance.
matchExpressionstringThe string that is to be matched.
patternstringThe pattern which may involve wildcards %,_,[,],^.
Returns
ILike(DbFunctions, string, string, string)
An implementation of the PostgreSQL ILIKE operation, which is an insensitive LIKE.
public static bool ILike(this DbFunctions _, string matchExpression, string pattern, string escapeCharacter)
Parameters
_DbFunctionsThe DbFunctions instance.
matchExpressionstringThe string that is to be matched.
patternstringThe pattern which may involve wildcards %,_,[,],^.
escapeCharacterstringThe escape character (as a single character string) to use in front of %,_,[,],^ if they are not used as wildcards.
Returns
LessThan(DbFunctions, ITuple, ITuple)
Returns whether the row value represented by a is less than the row value represented by b.
public static bool LessThan(this DbFunctions _, ITuple a, ITuple b)
Parameters
_DbFunctionsaITuplebITuple
Returns
Remarks
For more information on row value comparisons, see the PostgreSQL documentation.
LessThanOrEqual(DbFunctions, ITuple, ITuple)
Returns whether the row value represented by a is less than or equal to the row value represented by
b.
public static bool LessThanOrEqual(this DbFunctions _, ITuple a, ITuple b)
Parameters
_DbFunctionsaITuplebITuple
Returns
Remarks
For more information on row value comparisons, see the PostgreSQL documentation.
Reverse(DbFunctions, string)
Reverses a string by calling PostgreSQL reverse().
public static string Reverse(this DbFunctions _, string value)
Parameters
_DbFunctionsThe DbFunctions instance.
valuestringThe string that is to be reversed.
Returns
- string
The reversed string.
StringToArray(DbFunctions, string, string)
Splits value at occurrences of delimiter and forms the resulting fields into a text array.
public static string[] StringToArray(this DbFunctions _, string value, string delimiter)
Parameters
_DbFunctionsThe DbFunctions instance.
valuestringThe string to be split.
delimiterstringIf
null, each character in the string will become a separate element in the array. If an empty string, the string is treated as a single field.
Returns
- string[]
Exceptions
StringToArray(DbFunctions, string, string, string)
Splits value at occurrences of delimiter and forms the resulting fields into a text array.
public static string[] StringToArray(this DbFunctions _, string value, string delimiter, string nullString)
Parameters
_DbFunctionsThe DbFunctions instance.
valuestringThe string to be split.
delimiterstringIf
null, each character in the string will become a separate element in the array. If an empty string, the string is treated as a single field.nullStringstringFields matching this value string are replaced by
null.
Returns
- string[]
ToDate(DbFunctions, string, string)
Converts string to date according to the given format.
public static DateOnly ToDate(this DbFunctions _, string value, string format)
Parameters
_DbFunctionsThe DbFunctions instance.
valuestringThe string to be converted.
formatstringThe format of the input date.
Returns
ToTimestamp(DbFunctions, string, string)
Converts string to time stamp according to the given format.
public static DateTime ToTimestamp(this DbFunctions _, string value, string format)
Parameters
_DbFunctionsThe DbFunctions instance.
valuestringThe string to be converted
formatstringThe format of the input date