Copyright | 2015 Dylan Simon |
---|---|
Safe Haskell | None |
Language | Haskell98 |
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.
- 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
- class (PGType tr, PGType t) => PGRangeType tr t | tr -> 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
|
newtype LowerBound a Source #
Constructors
Lower | |
Fields
|
Instances
Functor LowerBound Source # | |
Bounded a => Bounded (LowerBound a) Source # | The constraint is only necessary for |
Eq a => Eq (LowerBound a) Source # | |
Ord a => Ord (LowerBound a) Source # | Takes into account open vs. closed (but does not understand equivalent discrete bounds) |
newtype UpperBound a Source #
Constructors
Upper | |
Fields
|
Instances
Functor UpperBound Source # | |
Bounded a => Bounded (UpperBound a) Source # | The constraint is only necessary for |
Eq a => Eq (UpperBound a) Source # | |
Ord a => Ord (UpperBound a) Source # | Takes into account open vs. closed (but does not understand equivalent discrete bounds) |
compareBounds :: Ord a => LowerBound a -> UpperBound a -> Bound Bool Source #
Constructors
Empty | |
Range | |
Fields
|
Instances
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 tr, PGType t) => PGRangeType tr t | tr -> 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.
Methods
pgRangeElementType :: PGTypeName tr -> PGTypeName t Source #
Instances
PGRangeType "daterange" "date" Source # | |
PGRangeType "int4range" "integer" Source # | |
PGRangeType "int8range" "bigint" Source # | |
PGRangeType "numrange" "numeric" Source # | |
PGRangeType "tsrange" "timestamp without time zone" Source # | |
PGRangeType "tstzrange" "timestamp with time zone" Source # | |