| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
PostgresqlTypes.Multirange
Contents
Synopsis
- data Multirange a
- toRangeList :: Multirange a -> [Range a]
- toRangeVector :: Multirange a -> Vector (Range a)
- normalizeFromRangeList :: Ord a => [Range a] -> Multirange a
- refineFromRangeList :: Ord a => [Range a] -> Maybe (Multirange a)
Documentation
data Multirange a Source #
Normalized representation of a multirange, which is a collection of non-overlapping, non-adjacent ranges.
PostgreSQL multirange types store multiple ranges as a single value, automatically normalizing them by combining overlapping and adjacent ranges. The ranges are stored in sorted order.
The following standard types are supported via the IsMultirangeElement instances:
int4multirange-Multirange Int4int8multirange-Multirange Int8nummultirange-Multirange Numerictsmultirange-Multirange Timestamptstzmultirange-Multirange Timestamptzdatemultirange-Multirange Date
You can also define your own.
Instances
Accessors
toRangeList :: Multirange a -> [Range a] Source #
Create a list of ranges from a multirange.
toRangeVector :: Multirange a -> Vector (Range a) Source #
Create a vector of ranges from a multirange.
Constructors
normalizeFromRangeList :: Ord a => [Range a] -> Multirange a Source #
Create a multirange from a list of ranges. Performs the same normalization as PostgreSQL: 1. Removes empty ranges 2. Sorts ranges by their lower bounds 3. Merges overlapping and adjacent ranges
refineFromRangeList :: Ord a => [Range a] -> Maybe (Multirange a) Source #
Attempt to create a multirange from a list of ranges.
Returns Nothing if the input list is not already normalized.