persistent-iproute-0.2.1: 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 
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
Data IP 
Ord IP 
Read IP 
Show IP 
IsString IP 
Generic IP 
type Rep IP = D1 D1IP ((:+:) (C1 C1_0IP (S1 S1_0_0IP (Rec0 IPv4))) (C1 C1_1IP (S1 S1_1_0IP (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 
Data IPRange 
Ord IPRange 
Read IPRange 
Show IPRange 
IsString IPRange 
Generic IPRange 
type Rep IPRange = D1 D1IPRange ((:+:) (C1 C1_0IPRange (S1 S1_0_0IPRange (Rec0 (AddrRange IPv4)))) (C1 C1_1IPRange (S1 S1_1_0IPRange (Rec0 (AddrRange IPv6)))))