Class NpgsqlDbFunctionsExtensions
Provides Npgsql-specific extension methods on
Namespace: Microsoft.EntityFrameworkCore
Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.dll
Syntax
public static class NpgsqlDbFunctionsExtensions
Methods
| Improve this Doc View SourceDistance(DbFunctions, DateOnly, DateOnly)
Returns the distance between two dates as a number of days, particularly suitable for sorting where the appropriate index is defined.
Declaration
public static int Distance(this DbFunctions _, DateOnly a, DateOnly b)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
DateOnly | a | |
DateOnly | b |
Returns
Type | Description |
---|---|
int |
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.
Declaration
public static TimeSpan Distance(this DbFunctions _, DateTime a, DateTime b)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
DateTime | a | |
DateTime | b |
Returns
Type | Description |
---|---|
TimeSpan |
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
.
Declaration
public static bool GreaterThan(this DbFunctions _, ITuple a, ITuple b)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
ITuple | a | |
ITuple | b |
Returns
Type | Description |
---|---|
bool |
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
.
Declaration
public static bool GreaterThanOrEqual(this DbFunctions _, ITuple a, ITuple b)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
ITuple | a | |
ITuple | b |
Returns
Type | Description |
---|---|
bool |
Remarks
For more information on row value comparisons, see the PostgreSQL documentation .
ILike(DbFunctions, string, string, string)
An implementation of the PostgreSQL ILIKE operation, which is an insensitive LIKE.
Declaration
public static bool ILike(this DbFunctions _, string matchExpression, string pattern, string escapeCharacter)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
string | matchExpression | The string that is to be matched. |
string | pattern | The pattern which may involve wildcards %,_,[,],^. |
string | escapeCharacter | The escape character (as a single character string) to use in front of %,_,[,],^ if they are not used as wildcards. |
Returns
Type | Description |
---|---|
bool | true if there is a match. |
ILike(DbFunctions, string, string)
An implementation of the PostgreSQL ILIKE operation, which is an insensitive LIKE.
Declaration
public static bool ILike(this DbFunctions _, string matchExpression, string pattern)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
string | matchExpression | The string that is to be matched. |
string | pattern | The pattern which may involve wildcards %,_,[,],^. |
Returns
Type | Description |
---|---|
bool | true if there is a match. |
LessThan(DbFunctions, ITuple, ITuple)
Returns whether the row value represented by a
is less than the row value represented by b
.
Declaration
public static bool LessThan(this DbFunctions _, ITuple a, ITuple b)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
ITuple | a | |
ITuple | b |
Returns
Type | Description |
---|---|
bool |
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
.
Declaration
public static bool LessThanOrEqual(this DbFunctions _, ITuple a, ITuple b)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
ITuple | a | |
ITuple | b |
Returns
Type | Description |
---|---|
bool |
Remarks
For more information on row value comparisons, see the PostgreSQL documentation .
Reverse(DbFunctions, string)
Reverses a string by calling PostgreSQL reverse()
.
Declaration
public static string Reverse(this DbFunctions _, string value)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
string | value | The string that is to be reversed. |
Returns
Type | Description |
---|---|
string | The reversed string. |