postgresql-typed-0.3.2: A PostgreSQL access library with compile-time SQL type inference

Copyright2015 Dylan Simon
Safe HaskellNone
LanguageHaskell98

Database.PostgreSQL.Typed.Range

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

Documentation

data Bound a Source

Constructors

Unbounded 
Bounded Bool a 

Instances

Functor Bound 
Eq a => Eq (Bound a) 

newtype LowerBound a Source

Constructors

Lower (Bound a) 

Instances

newtype UpperBound a Source

Constructors

Upper (Bound a) 

Instances

data Range a Source

Constructors

Empty 
Range (LowerBound a) (UpperBound a) 

Instances

Functor Range 
(PGRangeType tr t, PGColumn t a) => PGColumn tr (Range a) 
(PGRangeType tr t, PGParameter t a) => PGParameter tr (Range a) 
Eq a => Eq (Range a) 
Show a => Show (Range a) 

isEmpty :: Ord a => Range a -> Bool Source

point :: Eq a => a -> Range a Source

getPoint :: Eq a => Range a -> Maybe a Source

range :: Ord a => Bound a -> Bound a -> Range a Source

normal :: Ord a => Maybe a -> Maybe a -> Range a Source

bounded :: Ord a => a -> a -> Range a Source

normalize :: Ord a => Range a -> Range a Source

normalize' :: (Ord a, Enum a) => Range a -> Range a Source

normalize for discrete (non-continuous) range types, using the Enum instance

(@>) :: Ord a => Range a -> Range a -> Bool Source

(<@) :: Ord a => Range a -> Range a -> Bool Source

(@>.) :: Ord a => Range a -> a -> Bool Source

intersect :: Ord a => Range a -> Range a -> Range a Source

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.

Minimal complete definition

Nothing

Instances

PGRangeType "daterange" "date" 
PGRangeType "int4range" "integer" 
PGRangeType "int8range" "bigint" 
PGRangeType "numrange" "numeric" 
PGRangeType "tsrange" "timestamp without time zone" 
PGRangeType "tstzrange" "timestamp with time zone"