| Copyright | 2015 Dylan Simon |
|---|---|
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Database.PostgreSQL.Typed.Range
Contents
Description
Representaion of PostgreSQL's range type. There are a number of existing range data types, but PostgreSQL's is rather particular. This tries to provide a one-to-one mapping.
Synopsis
- data Bound a
- = Unbounded
- | Bounded {
- _boundClosed :: Bool
- _bound :: a
- newtype LowerBound a = Lower {
- boundLower :: Bound a
- newtype UpperBound a = Upper {
- boundUpper :: Bound a
- compareBounds :: Ord a => LowerBound a -> UpperBound a -> Bound Bool
- data Range a
- = Empty
- | Range {
- lower :: LowerBound a
- upper :: UpperBound a
- bound :: Bound a -> Maybe a
- boundClosed :: Bound a -> Bool
- makeBound :: Bool -> Maybe a -> Bound a
- lowerBound :: Range a -> Bound a
- upperBound :: Range a -> Bound a
- lowerClosed :: Range a -> Bool
- upperClosed :: Range a -> Bool
- empty :: Range a
- isEmpty :: Ord a => Range a -> Bool
- full :: Range a
- isFull :: Range a -> Bool
- point :: a -> Range a
- getPoint :: Eq a => Range a -> Maybe a
- range :: Ord a => Bound a -> Bound a -> Range a
- normal :: Ord a => Maybe a -> Maybe a -> Range a
- bounded :: Ord a => a -> a -> Range a
- normalize :: Ord a => Range a -> Range a
- normalize' :: (Ord a, Enum a) => Range a -> Range a
- (@>) :: Ord a => Range a -> Range a -> Bool
- (<@) :: Ord a => Range a -> Range a -> Bool
- (@>.) :: Ord a => Range a -> a -> Bool
- overlaps :: Ord a => Range a -> Range a -> Bool
- intersect :: Ord a => Range a -> Range a -> Range a
- union :: Ord a => Range a -> Range a -> Range a
- class (PGType t, PGType (PGSubType t)) => PGRangeType t where
Documentation
A end-point for a range, which may be nothing (infinity, NULL in PostgreSQL), open (inclusive), or closed (exclusive)
Constructors
| Unbounded | Equivalent to |
| Bounded | |
Fields
| |
Instances
newtype LowerBound a Source #
Constructors
| Lower | |
Fields
| |
Instances
| Functor LowerBound Source # | |
Defined in Database.PostgreSQL.Typed.Range Methods fmap :: (a -> b) -> LowerBound a -> LowerBound b # (<$) :: a -> LowerBound b -> LowerBound a # | |
| Bounded a => Bounded (LowerBound a) Source # | The constraint is only necessary for |
Defined in Database.PostgreSQL.Typed.Range | |
| Eq a => Eq (LowerBound a) Source # | |
Defined in Database.PostgreSQL.Typed.Range | |
| Ord a => Ord (LowerBound a) Source # | Takes into account open vs. closed (but does not understand equivalent discrete bounds) |
Defined in Database.PostgreSQL.Typed.Range Methods compare :: LowerBound a -> LowerBound a -> Ordering # (<) :: LowerBound a -> LowerBound a -> Bool # (<=) :: LowerBound a -> LowerBound a -> Bool # (>) :: LowerBound a -> LowerBound a -> Bool # (>=) :: LowerBound a -> LowerBound a -> Bool # max :: LowerBound a -> LowerBound a -> LowerBound a # min :: LowerBound a -> LowerBound a -> LowerBound a # | |
newtype UpperBound a Source #
Constructors
| Upper | |
Fields
| |
Instances
| Functor UpperBound Source # | |
Defined in Database.PostgreSQL.Typed.Range Methods fmap :: (a -> b) -> UpperBound a -> UpperBound b # (<$) :: a -> UpperBound b -> UpperBound a # | |
| Bounded a => Bounded (UpperBound a) Source # | The constraint is only necessary for |
Defined in Database.PostgreSQL.Typed.Range | |
| Eq a => Eq (UpperBound a) Source # | |
Defined in Database.PostgreSQL.Typed.Range | |
| Ord a => Ord (UpperBound a) Source # | Takes into account open vs. closed (but does not understand equivalent discrete bounds) |
Defined in Database.PostgreSQL.Typed.Range Methods compare :: UpperBound a -> UpperBound a -> Ordering # (<) :: UpperBound a -> UpperBound a -> Bool # (<=) :: UpperBound a -> UpperBound a -> Bool # (>) :: UpperBound a -> UpperBound a -> Bool # (>=) :: UpperBound a -> UpperBound a -> Bool # max :: UpperBound a -> UpperBound a -> UpperBound a # min :: UpperBound a -> UpperBound a -> UpperBound a # | |
compareBounds :: Ord a => LowerBound a -> UpperBound a -> Bound Bool Source #
Constructors
| Empty | |
| Range | |
Fields
| |
Instances
| Functor Range Source # | |
| (PGRangeType t, PGColumn (PGSubType t) a) => PGColumn t (Range a) Source # | |
| (PGRangeType t, PGParameter (PGSubType t) a) => PGParameter t (Range a) Source # | |
| Ord a => Monoid (Range a) Source # | |
| Ord a => Semigroup (Range a) Source # | |
| Show a => Show (Range a) Source # | |
| Eq a => Eq (Range a) Source # | |
| Ord a => Ord (Range a) Source # | |
Defined in Database.PostgreSQL.Typed.Range | |
boundClosed :: Bound a -> Bool Source #
Unbounded endpoints are always open.
makeBound :: Bool -> Maybe a -> Bound a Source #
Construct from parts: makeBound (boundClosed b) (bound b) == b
lowerClosed :: Range a -> Bool Source #
Equivalent to boundClosed . lowerBound
upperClosed :: Range a -> Bool Source #
Equivalent to boundClosed . upperBound
class (PGType t, PGType (PGSubType t)) => PGRangeType t where Source #
Class indicating that the first PostgreSQL type is a range of the second.
This implies PGParameter and PGColumn instances that will work for any type.
Minimal complete definition
Nothing
Instances
| PGRangeType "daterange" Source # | |
| PGRangeType "int4range" Source # | |
| PGRangeType "int8range" Source # | |
| PGRangeType "numrange" Source # | |
| PGRangeType "tsrange" Source # | |
| PGRangeType "tstzrange" Source # | |