postgresql-simple-0.7.0.1: Mid-Level PostgreSQL client library

Copyright | (c) 2014-2015 Leonid Onokhov (c) 2014-2015 Leon P Smith
License | BSD3
Maintainer | Leon P Smith <leon@melding-monads.com>
Safe Haskell | None
Language | Haskell2010

Database.PostgreSQL.Simple.Range

Description

Synopsis

- data RangeBound a
  - = NegInfinity
  - | Inclusive !a
  - | Exclusive !a
  - | PosInfinity
- data PGRange a = PGRange !(RangeBound a) !(RangeBound a)
- empty :: PGRange a
- isEmpty :: Ord a => PGRange a -> Bool
- isEmptyBy :: (a -> a -> Ordering) -> PGRange a -> Bool
- contains :: Ord a => PGRange a -> a -> Bool
- containsBy :: (a -> a -> Ordering) -> PGRange a -> a -> Bool
- fromFieldRange :: Typeable a => FieldParser a -> FieldParser (PGRange a)

# Documentation

data RangeBound a Source #

Represents boundary of a range

Constructors

NegInfinity |
Inclusive !a |
Exclusive !a |
PosInfinity |

#### Instances

Instances details

Functor RangeBound Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods fmap :: (a -> b) -> RangeBound a -> RangeBound b Source # (<$) :: a -> RangeBound b -> RangeBound a Source #
Show a => Show (RangeBound a) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods showsPrec :: Int -> RangeBound a -> ShowS Source # show :: RangeBound a -> String Source # showList :: [RangeBound a] -> ShowS Source #
Eq a => Eq (RangeBound a) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods (==) :: RangeBound a -> RangeBound a -> Bool Source # (/=) :: RangeBound a -> RangeBound a -> Bool Source #

data PGRange a Source #

Generic range type

Constructors

PGRange !(RangeBound a) !(RangeBound a) |

#### Instances

Instances details

Functor PGRange Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods fmap :: (a -> b) -> PGRange a -> PGRange b Source # (<$) :: a -> PGRange b -> PGRange a Source #
Show a => Show (PGRange a) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods showsPrec :: Int -> PGRange a -> ShowS Source # show :: PGRange a -> String Source # showList :: [PGRange a] -> ShowS Source #
Ord a => Eq (PGRange a) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods (==) :: PGRange a -> PGRange a -> Bool Source # (/=) :: PGRange a -> PGRange a -> Bool Source #
(FromField a, Typeable a) => FromField (PGRange a) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods fromField :: FieldParser (PGRange a) Source #
ToField (PGRange Int16) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Int16 -> Action Source #
ToField (PGRange Int32) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Int32 -> Action Source #
ToField (PGRange Int64) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Int64 -> Action Source #
ToField (PGRange Int8) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Int8 -> Action Source #
ToField (PGRange Word16) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Word16 -> Action Source #
ToField (PGRange Word32) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Word32 -> Action Source #
ToField (PGRange Word64) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Word64 -> Action Source #
ToField (PGRange Word8) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Word8 -> Action Source #
ToField (PGRange Date) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Date -> Action Source #
ToField (PGRange LocalTimestamp) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange LocalTimestamp -> Action Source #
ToField (PGRange UTCTimestamp) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange UTCTimestamp -> Action Source #
ToField (PGRange ZonedTimestamp) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange ZonedTimestamp -> Action Source #
ToField (PGRange Scientific) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Scientific -> Action Source #
ToField (PGRange Day) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Day -> Action Source #
ToField (PGRange NominalDiffTime) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange NominalDiffTime -> Action Source #
ToField (PGRange UTCTime) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange UTCTime -> Action Source #
ToField (PGRange LocalTime) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange LocalTime -> Action Source #
ToField (PGRange TimeOfDay) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange TimeOfDay -> Action Source #
ToField (PGRange ZonedTime) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange ZonedTime -> Action Source #
ToField (PGRange Integer) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Integer -> Action Source #
ToField (PGRange Double) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Double -> Action Source #
ToField (PGRange Float) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Float -> Action Source #
ToField (PGRange Int) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Int -> Action Source #
ToField (PGRange Word) Source # |
Instance details Defined in Database.PostgreSQL.Simple.Range Methods toField :: PGRange Word -> Action Source #

empty :: PGRange a Source #

isEmpty :: Ord a => PGRange a -> Bool Source #

Is a range empty? If this returns `True`, then the `contains` predicate will always return `False`. However, if this returns `False`, it is not necessarily true that there exists a point for which `contains` returns `True`. Consider ``PGRange` (`Excludes` 2) (`Excludes` 3) :: PGRange Int`, for example.

isEmptyBy :: (a -> a -> Ordering) -> PGRange a -> Bool Source #

contains :: Ord a => PGRange a -> a -> Bool Source #

Does a range contain a given point? Note that in some cases, this may not correspond exactly with a server-side computation. Consider `UTCTime` for example, which has a resolution of a picosecond, whereas postgresql's `timestamptz` types have a resolution of a microsecond. Putting such Haskell values into the database will result in them being rounded, which can change the value of the containment predicate.

containsBy :: (a -> a -> Ordering) -> PGRange a -> a -> Bool Source #

fromFieldRange :: Typeable a => FieldParser a -> FieldParser (PGRange a) Source #