persistent-iproute-0.2.3: Persistent instances for types in iproute

Safe HaskellNone
LanguageHaskell2010

Database.Persist.IP

Description

This module adds support for some of PostgreSQL operators on IP addresses and networks. See http://www.postgresql.org/docs/9.4/static/functions-net.html for more detailed documentation

Synopsis

Documentation

(<:<.) :: EntityField record IPRange -> IPRange -> Filter record Source #

The record range is contained within the specified range. Corresponds to PgSQL operator <<.

(>:>.) :: EntityField record IPRange -> IPRange -> Filter record Source #

The record range contains the specified range. Corresponds to PgSQL operator >>.

(<:<=) :: EntityField record IPRange -> IPRange -> Filter record Source #

The record range is contained within or equals to the specified range. Corresponds to PgSQL operator <<=.

(>:>=) :: EntityField record IPRange -> IPRange -> Filter record Source #

The record range contains or equals to the specified range. Corresponds to PgSQL operator >>=.

(<.<.) :: EntityField record IP -> IPRange -> Filter record Source #

The record address is contained within the specified range. Corresponds to PgSQL operator <<.

(>.>.) :: EntityField record IPRange -> IP -> Filter record Source #

The record range contains the specified address. Corresponds to PgSQL operator >>.

data IP :: * #

A unified IP data for IPv4 and IPv6. To create this, use the data constructors. Or use read "192.0.2.1" :: IP, for example. Also, "192.0.2.1" can be used as literal with OverloadedStrings.

>>> (read "192.0.2.1" :: IP) == IPv4 (read "192.0.2.1" :: IPv4)
True
>>> (read "2001:db8:00:00:00:00:00:01" :: IP) == IPv6 (read "2001:db8:00:00:00:00:00:01" :: IPv6)
True

Instances

Enum IP 

Methods

succ :: IP -> IP #

pred :: IP -> IP #

toEnum :: Int -> IP #

fromEnum :: IP -> Int #

enumFrom :: IP -> [IP] #

enumFromThen :: IP -> IP -> [IP] #

enumFromTo :: IP -> IP -> [IP] #

enumFromThenTo :: IP -> IP -> IP -> [IP] #

Eq IP

Equality over IP addresses. Correctly compare IPv4 and IPv4-embedded-in-IPv6 addresses.

>>> (read "2001:db8:00:00:00:00:00:01" :: IP) == (read "2001:db8:00:00:00:00:00:01" :: IP)
True
>>> (read "2001:db8:00:00:00:00:00:01" :: IP) == (read "2001:db8:00:00:00:00:00:05" :: IP)
False
>>> (read "127.0.0.1" :: IP) == (read "127.0.0.1" :: IP)
True
>>> (read "127.0.0.1" :: IP) == (read "10.0.0.1" :: IP)
False
>>> (read "::ffff:127.0.0.1" :: IP) == (read "127.0.0.1" :: IP)
True
>>> (read "::ffff:127.0.0.1" :: IP) == (read "127.0.0.9" :: IP)
False
>>> (read "::ffff:127.0.0.1" :: IP) >= (read "127.0.0.1" :: IP)
True
>>> (read "::ffff:127.0.0.1" :: IP) <= (read "127.0.0.1" :: IP)
True

Methods

(==) :: IP -> IP -> Bool #

(/=) :: IP -> IP -> Bool #

Data IP 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IP -> c IP #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IP #

toConstr :: IP -> Constr #

dataTypeOf :: IP -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c IP) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IP) #

gmapT :: (forall b. Data b => b -> b) -> IP -> IP #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IP -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IP -> r #

gmapQ :: (forall d. Data d => d -> u) -> IP -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> IP -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> IP -> m IP #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IP -> m IP #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IP -> m IP #

Ord IP 

Methods

compare :: IP -> IP -> Ordering #

(<) :: IP -> IP -> Bool #

(<=) :: IP -> IP -> Bool #

(>) :: IP -> IP -> Bool #

(>=) :: IP -> IP -> Bool #

max :: IP -> IP -> IP #

min :: IP -> IP -> IP #

Read IP 
Show IP 

Methods

showsPrec :: Int -> IP -> ShowS #

show :: IP -> String #

showList :: [IP] -> ShowS #

IsString IP 

Methods

fromString :: String -> IP #

Generic IP 

Associated Types

type Rep IP :: * -> * #

Methods

from :: IP -> Rep IP x #

to :: Rep IP x -> IP #

type Rep IP 
type Rep IP = D1 (MetaData "IP" "Data.IP.Addr" "iproute-1.7.1-9hsGfRvggCmFA0ueZi5Sd9" False) ((:+:) (C1 (MetaCons "IPv4" PrefixI True) (S1 (MetaSel (Just Symbol "ipv4") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 IPv4))) (C1 (MetaCons "IPv6" PrefixI True) (S1 (MetaSel (Just Symbol "ipv6") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 IPv6))))

data IPRange :: * #

A unified data for AddrRange IPv4 and AddrRange IPv6. To create this, use read "192.0.2.0/24" :: IPRange. Also, "192.0.2.0/24" can be used as literal with OverloadedStrings.

>>> (read "192.0.2.1/24" :: IPRange) == IPv4Range (read "192.0.2.0/24" :: AddrRange IPv4)
True
>>> (read "2001:db8:00:00:00:00:00:01/48" :: IPRange) == IPv6Range (read "2001:db8:00:00:00:00:00:01/48" :: AddrRange IPv6)
True

Instances

Eq IPRange 

Methods

(==) :: IPRange -> IPRange -> Bool #

(/=) :: IPRange -> IPRange -> Bool #

Data IPRange 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> IPRange -> c IPRange #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c IPRange #

toConstr :: IPRange -> Constr #

dataTypeOf :: IPRange -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c IPRange) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c IPRange) #

gmapT :: (forall b. Data b => b -> b) -> IPRange -> IPRange #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> IPRange -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> IPRange -> r #

gmapQ :: (forall d. Data d => d -> u) -> IPRange -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> IPRange -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> IPRange -> m IPRange #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> IPRange -> m IPRange #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> IPRange -> m IPRange #

Ord IPRange 
Read IPRange 
Show IPRange 
IsString IPRange 

Methods

fromString :: String -> IPRange #

Generic IPRange 

Associated Types

type Rep IPRange :: * -> * #

Methods

from :: IPRange -> Rep IPRange x #

to :: Rep IPRange x -> IPRange #

type Rep IPRange 
type Rep IPRange = D1 (MetaData "IPRange" "Data.IP.Range" "iproute-1.7.1-9hsGfRvggCmFA0ueZi5Sd9" False) ((:+:) (C1 (MetaCons "IPv4Range" PrefixI True) (S1 (MetaSel (Just Symbol "ipv4range") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AddrRange IPv4)))) (C1 (MetaCons "IPv6Range" PrefixI True) (S1 (MetaSel (Just Symbol "ipv6range") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (AddrRange IPv6)))))