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
_
DbFunctionsa
DateOnlyb
DateOnly
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
_
DbFunctionsa
DateTimeb
DateTime
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
_
DbFunctionsa
ITupleb
ITuple
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
_
DbFunctionsa
ITupleb
ITuple
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.
matchExpression
stringThe string that is to be matched.
pattern
stringThe 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.
matchExpression
stringThe string that is to be matched.
pattern
stringThe pattern which may involve wildcards %,_,[,],^.
escapeCharacter
stringThe 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
_
DbFunctionsa
ITupleb
ITuple
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
_
DbFunctionsa
ITupleb
ITuple
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.
value
stringThe 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.
value
stringThe string to be split.
delimiter
stringIf
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.
value
stringThe string to be split.
delimiter
stringIf
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.nullString
stringFields matching this value string are replaced by
null
.
Returns
- string[]