PgInterval

sealed interface PgInterval

Represents a PostgreSQL interval type, which can be a finite period of time or infinite.

Inheritors

Types

Link copied to clipboard
data class Finite(val time: Long, val days: Int, val months: Int) : PgInterval

Represents a finite PostgreSQL interval.

Link copied to clipboard
data object Infinity : PgInterval

Represents a PostgreSQL positive infinity interval.

Link copied to clipboard

Represents a PostgreSQL negative infinity interval.

Functions

Link copied to clipboard
fun PgInterval.toDateTimePeriod(): DateTimePeriod

Converts this PgInterval to a Kotlinx DateTimePeriod.

Link copied to clipboard

Converts by flattening everything to microseconds, assuming (like PostgreSQL justify_interval): 1 month = 30 days, 1 day = 24 hours.

Link copied to clipboard

Converts strictly. The interval cannot have days and months set, because they have variable length in the calendar.