# Class NpgsqlNodaTimeDbFunctionsExtensions

Namespace
  Microsoft.EntityFrameworkCore

Assembly
  Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime.dll

Provides extension methods supporting NodaTime function translation for PostgreSQL.

    public static class NpgsqlNodaTimeDbFunctionsExtensions

Inheritance
  object
  NpgsqlNodaTimeDbFunctionsExtensions

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

## Methods

### Average(DbFunctions, IEnumerable<Duration>)

Computes the average (arithmetic mean) of the non-null input intervals. Corresponds to the PostgreSQL `avg` aggregate function.

    public static Duration? Average(this DbFunctions _, IEnumerable<Duration> input)

#### Parameters

`_` DbFunctions

  The DbFunctions instance.

`input` IEnumerable<Duration>

  The input values to be computed into an average.

#### Returns

Duration?

#### Exceptions

NotSupportedException

  Average(DbFunctions, IEnumerable<Duration>) is only intended for use via SQL translation as part of an EF Core LINQ query.

See Also
  PostgreSQL documentation for aggregate functions.

### Average(DbFunctions, IEnumerable<Period>)

Computes the average (arithmetic mean) of the non-null input intervals. Corresponds to the PostgreSQL `avg` aggregate function.

    public static Period? Average(this DbFunctions _, IEnumerable<Period> input)

#### Parameters

`_` DbFunctions

  The DbFunctions instance.

`input` IEnumerable<Period>

  The input values to be computed into an average.

#### Returns

Period

#### Exceptions

NotSupportedException

  Average(DbFunctions, IEnumerable<Period>) is only intended for use via SQL translation as part of an EF Core LINQ query.

See Also
  PostgreSQL documentation for aggregate functions.

### Distance(DbFunctions, Instant, Instant)

Returns the distance between two instants as a Period, particularly suitable for sorting where the appropriate index is defined.

    public static int Distance(this DbFunctions _, Instant a, Instant b)

#### Parameters

`_` DbFunctions
`a` Instant
`b` Instant

#### Returns

int

#### Remarks

This requires the `btree_gist` built-in PostgreSQL extension, see https://www.postgresql.org/docs/current/btree-gist.html.

### Distance(DbFunctions, LocalDate, LocalDate)

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 _, LocalDate a, LocalDate b)

#### Parameters

`_` DbFunctions
`a` LocalDate
`b` LocalDate

#### Returns

int

#### Remarks

This requires the `btree_gist` built-in PostgreSQL extension, see https://www.postgresql.org/docs/current/btree-gist.html.

### Distance(DbFunctions, LocalDateTime, LocalDateTime)

Returns the distance between two local timestamps as a Period, particularly suitable for sorting where the appropriate index is defined.

    public static int Distance(this DbFunctions _, LocalDateTime a, LocalDateTime b)

#### Parameters

`_` DbFunctions
`a` LocalDateTime
`b` LocalDateTime

#### Returns

int

#### Remarks

This requires the `btree_gist` built-in PostgreSQL extension, see https://www.postgresql.org/docs/current/btree-gist.html.

### Distance(DbFunctions, ZonedDateTime, ZonedDateTime)

Returns the distance between two zoned timestamps as a Period, particularly suitable for sorting where the appropriate index is defined.

    public static int Distance(this DbFunctions _, ZonedDateTime a, ZonedDateTime b)

#### Parameters

`_` DbFunctions
`a` ZonedDateTime
`b` ZonedDateTime

#### Returns

int

#### Remarks

This requires the `btree_gist` built-in PostgreSQL extension, see https://www.postgresql.org/docs/current/btree-gist.html.

### RangeAgg(DbFunctions, IEnumerable<DateInterval>)

Computes the union of the non-null input date intervals. Corresponds to the PostgreSQL `range_agg` aggregate function.

    public static DateInterval[] RangeAgg(this DbFunctions _, IEnumerable<DateInterval> input)

#### Parameters

`_` DbFunctions

  The DbFunctions instance.

`input` IEnumerable<DateInterval>

  The date intervals to be aggregated via union into a multirange.

#### Returns

DateInterval[]

#### Exceptions

NotSupportedException

  RangeAgg(DbFunctions, IEnumerable<DateInterval>) is only intended for use via SQL translation as part of an EF Core LINQ query.

See Also
  PostgreSQL documentation for aggregate functions.

### RangeAgg(DbFunctions, IEnumerable<Interval>)

Computes the union of the non-null input intervals. Corresponds to the PostgreSQL `range_agg` aggregate function.

    public static Interval[] RangeAgg(this DbFunctions _, IEnumerable<Interval> input)

#### Parameters

`_` DbFunctions

  The DbFunctions instance.

`input` IEnumerable<Interval>

  The intervals to be aggregated via union into a multirange.

#### Returns

Interval[]

#### Exceptions

NotSupportedException

  RangeAgg(DbFunctions, IEnumerable<Interval>) is only intended for use via SQL translation as part of an EF Core LINQ query.

See Also
  PostgreSQL documentation for aggregate functions.

### RangeIntersectAgg(DbFunctions, IEnumerable<DateInterval[]>)

Computes the intersection of the non-null input date interval multiranges. Corresponds to the PostgreSQL `range_intersect_agg` aggregate function.

    public static DateInterval[] RangeIntersectAgg(this DbFunctions _, IEnumerable<DateInterval[]> input)

#### Parameters

`_` DbFunctions

  The DbFunctions instance.

`input` IEnumerable<DateInterval[]>

  The date intervals on which to perform the intersection operation.

#### Returns

DateInterval[]

#### Exceptions

NotSupportedException

  RangeIntersectAgg(DbFunctions, IEnumerable<DateInterval[]>) is only intended for use via SQL translation as part of an EF Core LINQ query.

See Also
  PostgreSQL documentation for aggregate functions.

### RangeIntersectAgg(DbFunctions, IEnumerable<DateInterval>)

Computes the intersection of the non-null input date intervals. Corresponds to the PostgreSQL `range_intersect_agg` aggregate function.

    public static DateInterval RangeIntersectAgg(this DbFunctions _, IEnumerable<DateInterval> input)

#### Parameters

`_` DbFunctions

  The DbFunctions instance.

`input` IEnumerable<DateInterval>

  The date intervals on which to perform the intersection operation.

#### Returns

DateInterval

#### Exceptions

NotSupportedException

  RangeIntersectAgg(DbFunctions, IEnumerable<DateInterval>) is only intended for use via SQL translation as part of an EF Core LINQ query.

See Also
  PostgreSQL documentation for aggregate functions.

### RangeIntersectAgg(DbFunctions, IEnumerable<Interval[]>)

Computes the intersection of the non-null input interval multiranges. Corresponds to the PostgreSQL `range_intersect_agg` aggregate function.

    public static Interval[] RangeIntersectAgg(this DbFunctions _, IEnumerable<Interval[]> input)

#### Parameters

`_` DbFunctions

  The DbFunctions instance.

`input` IEnumerable<Interval[]>

  The intervals on which to perform the intersection operation.

#### Returns

Interval[]

#### Exceptions

NotSupportedException

  RangeIntersectAgg(DbFunctions, IEnumerable<Interval[]>) is only intended for use via SQL translation as part of an EF Core LINQ query.

See Also
  PostgreSQL documentation for aggregate functions.

### RangeIntersectAgg(DbFunctions, IEnumerable<Interval>)

Computes the intersection of the non-null input intervals. Corresponds to the PostgreSQL `range_intersect_agg` aggregate function.

    public static Interval RangeIntersectAgg(this DbFunctions _, IEnumerable<Interval> input)

#### Parameters

`_` DbFunctions

  The DbFunctions instance.

`input` IEnumerable<Interval>

  The intervals on which to perform the intersection operation.

#### Returns

Interval

#### Exceptions

NotSupportedException

  RangeIntersectAgg(DbFunctions, IEnumerable<Interval>) is only intended for use via SQL translation as part of an EF Core LINQ query.

See Also
  PostgreSQL documentation for aggregate functions.

### Sum(DbFunctions, IEnumerable<Duration>)

Computes the sum of the non-null input intervals. Corresponds to the PostgreSQL `sum` aggregate function.

    public static Duration? Sum(this DbFunctions _, IEnumerable<Duration> input)

#### Parameters

`_` DbFunctions

  The DbFunctions instance.

`input` IEnumerable<Duration>

  The input values to be summed.

#### Returns

Duration?

#### Exceptions

NotSupportedException

  Sum(DbFunctions, IEnumerable<Duration>) is only intended for use via SQL translation as part of an EF Core LINQ query.

See Also
  PostgreSQL documentation for aggregate functions.

### Sum(DbFunctions, IEnumerable<Period>)

Computes the sum of the non-null input intervals. Corresponds to the PostgreSQL `sum` aggregate function.

    public static Period? Sum(this DbFunctions _, IEnumerable<Period> input)

#### Parameters

`_` DbFunctions

  The DbFunctions instance.

`input` IEnumerable<Period>

  The input values to be summed.

#### Returns

Period

#### Exceptions

NotSupportedException

  Sum(DbFunctions, IEnumerable<Period>) is only intended for use via SQL translation as part of an EF Core LINQ query.

See Also
  PostgreSQL documentation for aggregate functions.