# Class NpgsqlDbFunctionsExtensions

Namespace
  Microsoft.EntityFrameworkCore

Assembly
  Npgsql.EntityFrameworkCore.PostgreSQL.dll

Provides Npgsql-specific extension methods on DbFunctions.

    public static class NpgsqlDbFunctionsExtensions

Inheritance
  object
  NpgsqlDbFunctionsExtensions

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## 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

`_` DbFunctions
`a` DateOnly
`b` DateOnly

#### Returns

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.

    public static TimeSpan Distance(this DbFunctions _, DateTime a, DateTime b)

#### Parameters

`_` DbFunctions
`a` DateTime
`b` DateTime

#### Returns

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`.

    public static bool GreaterThan(this DbFunctions _, ITuple a, ITuple b)

#### Parameters

`_` DbFunctions
`a` ITuple
`b` ITuple

#### Returns

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`.

    public static bool GreaterThanOrEqual(this DbFunctions _, ITuple a, ITuple b)

#### Parameters

`_` DbFunctions
`a` ITuple
`b` ITuple

#### Returns

bool

#### 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

`_` DbFunctions

  The DbFunctions instance.

`matchExpression` string

  The string that is to be matched.

`pattern` string

  The pattern which may involve wildcards %,_,[,],^.

#### Returns

bool

  true if there is a match.

### 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

`_` DbFunctions

  The DbFunctions instance.

`matchExpression` string

  The string that is to be matched.

`pattern` string

  The pattern which may involve wildcards %,_,[,],^.

`escapeCharacter` string

  The escape character (as a single character string) to use in front of %,_,[,],^ if they are not used as wildcards.

#### Returns

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`.

    public static bool LessThan(this DbFunctions _, ITuple a, ITuple b)

#### Parameters

`_` DbFunctions
`a` ITuple
`b` ITuple

#### Returns

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`.

    public static bool LessThanOrEqual(this DbFunctions _, ITuple a, ITuple b)

#### Parameters

`_` DbFunctions
`a` ITuple
`b` ITuple

#### Returns

bool

#### 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

`_` DbFunctions

  The DbFunctions instance.

`value` string

  The 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

`_` DbFunctions

  The DbFunctions instance.

`value` string

  The string to be split.

`delimiter` string

  If `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

InvalidOperationException

### 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

`_` DbFunctions

  The DbFunctions instance.

`value` string

  The string to be split.

`delimiter` string

  If `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` string

  Fields matching this value string are replaced by `null`.

#### Returns

string[]