Class NpgsqlNodaTimeDbFunctionsExtensions
Provides extension methods supporting NodaTime function translation for PostgreSQL.
Namespace: Microsoft.EntityFrameworkCore
Assembly: Npgsql.EntityFrameworkCore.PostgreSQL.NodaTime.dll
Syntax
public static class NpgsqlNodaTimeDbFunctionsExtensions
Methods
| Improve this Doc View SourceAverage(DbFunctions, IEnumerable<Duration>)
Computes the average (arithmetic mean) of the non-null input intervals. Corresponds to the PostgreSQL avg
aggregate function.
Declaration
public static Duration? Average(this DbFunctions _, IEnumerable<Duration> input)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
IEnumerable<><Duration> | input | The input values to be computed into an average. |
Returns
Type | Description |
---|---|
Duration? |
See Also
| Improve this Doc View SourceAverage(DbFunctions, IEnumerable<Period>)
Computes the average (arithmetic mean) of the non-null input intervals. Corresponds to the PostgreSQL avg
aggregate function.
Declaration
public static Period? Average(this DbFunctions _, IEnumerable<Period> input)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
IEnumerable<><Period> | input | The input values to be computed into an average. |
Returns
Type | Description |
---|---|
Period? |
See Also
| Improve this Doc View SourceDistance(DbFunctions, Instant, Instant)
Returns the distance between two instants as a
Declaration
public static int Distance(this DbFunctions _, Instant a, Instant b)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
Instant | a | |
Instant | 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, LocalDate, LocalDate)
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 _, LocalDate a, LocalDate b)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
LocalDate | a | |
LocalDate | 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, LocalDateTime, LocalDateTime)
Returns the distance between two local timestamps as a
Declaration
public static int Distance(this DbFunctions _, LocalDateTime a, LocalDateTime b)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
LocalDateTime | a | |
LocalDateTime | 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, ZonedDateTime, ZonedDateTime)
Returns the distance between two zoned timestamps as a
Declaration
public static int Distance(this DbFunctions _, ZonedDateTime a, ZonedDateTime b)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | |
ZonedDateTime | a | |
ZonedDateTime | 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.
RangeAgg(DbFunctions, IEnumerable<DateInterval>)
Computes the union of the non-null input date intervals. Corresponds to the PostgreSQL range_agg
aggregate function.
Declaration
public static DateInterval[] RangeAgg(this DbFunctions _, IEnumerable<DateInterval> input)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
IEnumerable<><DateInterval> | input | The date intervals to be aggregated via union into a multirange. |
Returns
Type | Description |
---|---|
DateInterval[] |
See Also
| Improve this Doc View SourceRangeAgg(DbFunctions, IEnumerable<Interval>)
Computes the union of the non-null input intervals. Corresponds to the PostgreSQL range_agg
aggregate function.
Declaration
public static Interval[] RangeAgg(this DbFunctions _, IEnumerable<Interval> input)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
IEnumerable<><Interval> | input | The intervals to be aggregated via union into a multirange. |
Returns
Type | Description |
---|---|
Interval[] |
See Also
| Improve this Doc View SourceRangeIntersectAgg(DbFunctions, IEnumerable<DateInterval[]>)
Computes the intersection of the non-null input date interval multiranges.
Corresponds to the PostgreSQL range_intersect_agg
aggregate function.
Declaration
public static DateInterval[] RangeIntersectAgg(this DbFunctions _, IEnumerable<DateInterval[]> input)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
IEnumerable<><DateInterval[]> | input | The date intervals on which to perform the intersection operation. |
Returns
Type | Description |
---|---|
DateInterval[] |
See Also
| Improve this Doc View SourceRangeIntersectAgg(DbFunctions, IEnumerable<DateInterval>)
Computes the intersection of the non-null input date intervals. Corresponds to the PostgreSQL range_intersect_agg
aggregate function.
Declaration
public static DateInterval RangeIntersectAgg(this DbFunctions _, IEnumerable<DateInterval> input)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
IEnumerable<><DateInterval> | input | The date intervals on which to perform the intersection operation. |
Returns
Type | Description |
---|---|
DateInterval |
See Also
| Improve this Doc View SourceRangeIntersectAgg(DbFunctions, IEnumerable<Interval[]>)
Computes the intersection of the non-null input interval multiranges.
Corresponds to the PostgreSQL range_intersect_agg
aggregate function.
Declaration
public static Interval[] RangeIntersectAgg(this DbFunctions _, IEnumerable<Interval[]> input)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
IEnumerable<><Interval[]> | input | The intervals on which to perform the intersection operation. |
Returns
Type | Description |
---|---|
Interval[] |
See Also
| Improve this Doc View SourceRangeIntersectAgg(DbFunctions, IEnumerable<Interval>)
Computes the intersection of the non-null input intervals. Corresponds to the PostgreSQL range_intersect_agg
aggregate function.
Declaration
public static Interval RangeIntersectAgg(this DbFunctions _, IEnumerable<Interval> input)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
IEnumerable<><Interval> | input | The intervals on which to perform the intersection operation. |
Returns
Type | Description |
---|---|
Interval |
See Also
| Improve this Doc View SourceSum(DbFunctions, IEnumerable<Duration>)
Computes the sum of the non-null input intervals. Corresponds to the PostgreSQL sum
aggregate function.
Declaration
public static Duration? Sum(this DbFunctions _, IEnumerable<Duration> input)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
IEnumerable<><Duration> | input | The input values to be summed. |
Returns
Type | Description |
---|---|
Duration? |
See Also
| Improve this Doc View SourceSum(DbFunctions, IEnumerable<Period>)
Computes the sum of the non-null input intervals. Corresponds to the PostgreSQL sum
aggregate function.
Declaration
public static Period? Sum(this DbFunctions _, IEnumerable<Period> input)
Parameters
Type | Name | Description |
---|---|---|
DbFunctions | _ | The |
IEnumerable<><Period> | input | The input values to be summed. |
Returns
Type | Description |
---|---|
Period? |