| 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 | Haskell98 |
Database.PostgreSQL.Simple.Range
Description
- 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
Documentation
data RangeBound a #
Represents boundary of a range
Constructors
| NegInfinity | |
| Inclusive !a | |
| Exclusive !a | |
| PosInfinity |
Instances
| Functor RangeBound # | |
| Eq a => Eq (RangeBound a) # | |
| Show a => Show (RangeBound a) # | |
Generic range type
Constructors
| PGRange !(RangeBound a) !(RangeBound a) |
Instances
| Functor PGRange # | |
| Ord a => Eq (PGRange a) # | |
| Show a => Show (PGRange a) # | |
| (FromField a, Typeable * a) => FromField (PGRange a) # | |
| ToField (PGRange Double) # | |
| ToField (PGRange Float) # | |
| ToField (PGRange Int) # | |
| ToField (PGRange Int8) # | |
| ToField (PGRange Int16) # | |
| ToField (PGRange Int32) # | |
| ToField (PGRange Int64) # | |
| ToField (PGRange Integer) # | |
| ToField (PGRange Word) # | |
| ToField (PGRange Word8) # | |
| ToField (PGRange Word16) # | |
| ToField (PGRange Word32) # | |
| ToField (PGRange Word64) # | |
| ToField (PGRange Scientific) # | |
| ToField (PGRange UTCTime) # | |
| ToField (PGRange LocalTime) # | |
| ToField (PGRange ZonedTime) # | |
| ToField (PGRange TimeOfDay) # | |
| ToField (PGRange NominalDiffTime) # | |
| ToField (PGRange Day) # | |
| ToField (PGRange Date) # | |
| ToField (PGRange ZonedTimestamp) # | |
| ToField (PGRange UTCTimestamp) # | |
| ToField (PGRange LocalTimestamp) # | |
contains :: Ord a => PGRange a -> a -> Bool #
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 #