on dev help sign in
db ~> schemas
commitaef1c848d417f7f344e991294064c736fd8e62e6 authorEitan Chatav <eitan.chatav@gmail.com> dateWed 5 Dec 2018, 09:31 (8 years ago) parentb1f9173
1 file changed+56−56
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+56−56
squeal-postgresql/src/Squeal/PostgreSQL/Expression.hs+56−56
@@ -1651,125 +1651,125 @@ typeview
16511651typeview = UnsafeTypeExpression . renderQualifiedAlias
16521652
16531653-- | logical Boolean (true/false)
1654−bool :: TypeExpression db (nullity 'PGbool)
1654+bool :: TypeExpression schemas (nullity 'PGbool)
16551655bool = UnsafeTypeExpression "bool"
16561656-- | signed two-byte integer
1657−int2, smallint :: TypeExpression db (nullity 'PGint2)
1657+int2, smallint :: TypeExpression schemas (nullity 'PGint2)
16581658int2 = UnsafeTypeExpression "int2"
16591659smallint = UnsafeTypeExpression "smallint"
16601660-- | signed four-byte integer
1661−int4, int, integer :: TypeExpression db (nullity 'PGint4)
1661+int4, int, integer :: TypeExpression schemas (nullity 'PGint4)
16621662int4 = UnsafeTypeExpression "int4"
16631663int = UnsafeTypeExpression "int"
16641664integer = UnsafeTypeExpression "integer"
16651665-- | signed eight-byte integer
1666−int8, bigint :: TypeExpression db (nullity 'PGint8)
1666+int8, bigint :: TypeExpression schemas (nullity 'PGint8)
16671667int8 = UnsafeTypeExpression "int8"
16681668bigint = UnsafeTypeExpression "bigint"
16691669-- | arbitrary precision numeric type
1670−numeric :: TypeExpression db (nullity 'PGnumeric)
1670+numeric :: TypeExpression schemas (nullity 'PGnumeric)
16711671numeric = UnsafeTypeExpression "numeric"
16721672-- | single precision floating-point number (4 bytes)
1673−float4, real :: TypeExpression db (nullity 'PGfloat4)
1673+float4, real :: TypeExpression schemas (nullity 'PGfloat4)
16741674float4 = UnsafeTypeExpression "float4"
16751675real = UnsafeTypeExpression "real"
16761676-- | double precision floating-point number (8 bytes)
1677−float8, doublePrecision :: TypeExpression db (nullity 'PGfloat8)
1677+float8, doublePrecision :: TypeExpression schemas (nullity 'PGfloat8)
16781678float8 = UnsafeTypeExpression "float8"
16791679doublePrecision = UnsafeTypeExpression "double precision"
16801680-- | variable-length character string
1681−text :: TypeExpression db (nullity 'PGtext)
1681+text :: TypeExpression schemas (nullity 'PGtext)
16821682text = UnsafeTypeExpression "text"
16831683-- | fixed-length character string
16841684char, character
1685− :: forall n db nullity. (KnownNat n, 1 <= n)
1686− => TypeExpression db (nullity ('PGchar n))
1685+ :: forall n schemas nullity. (KnownNat n, 1 <= n)
1686+ => TypeExpression schemas (nullity ('PGchar n))
16871687char = UnsafeTypeExpression $ "char(" <> renderNat @n <> ")"
16881688character = UnsafeTypeExpression $ "character(" <> renderNat @n <> ")"
16891689-- | variable-length character string
16901690varchar, characterVarying
1691− :: forall n db nullity. (KnownNat n, 1 <= n)
1692− => TypeExpression db (nullity ('PGvarchar n))
1691+ :: forall n schemas nullity. (KnownNat n, 1 <= n)
1692+ => TypeExpression schemas (nullity ('PGvarchar n))
16931693varchar = UnsafeTypeExpression $ "varchar(" <> renderNat @n <> ")"
16941694characterVarying = UnsafeTypeExpression $
16951695 "character varying(" <> renderNat @n <> ")"
16961696-- | binary data ("byte array")
1697−bytea :: TypeExpression db (nullity 'PGbytea)
1697+bytea :: TypeExpression schemas (nullity 'PGbytea)
16981698bytea = UnsafeTypeExpression "bytea"
16991699-- | date and time (no time zone)
1700−timestamp :: TypeExpression db (nullity 'PGtimestamp)
1700+timestamp :: TypeExpression schemas (nullity 'PGtimestamp)
17011701timestamp = UnsafeTypeExpression "timestamp"
17021702-- | date and time, including time zone
1703−timestampWithTimeZone :: TypeExpression db (nullity 'PGtimestamptz)
1703+timestampWithTimeZone :: TypeExpression schemas (nullity 'PGtimestamptz)
17041704timestampWithTimeZone = UnsafeTypeExpression "timestamp with time zone"
17051705-- | calendar date (year, month, day)
1706−date :: TypeExpression db (nullity 'PGdate)
1706+date :: TypeExpression schemas (nullity 'PGdate)
17071707date = UnsafeTypeExpression "date"
17081708-- | time of day (no time zone)
1709−time :: TypeExpression db (nullity 'PGtime)
1709+time :: TypeExpression schemas (nullity 'PGtime)
17101710time = UnsafeTypeExpression "time"
17111711-- | time of day, including time zone
1712−timeWithTimeZone :: TypeExpression db (nullity 'PGtimetz)
1712+timeWithTimeZone :: TypeExpression schemas (nullity 'PGtimetz)
17131713timeWithTimeZone = UnsafeTypeExpression "time with time zone"
17141714-- | time span
1715−interval :: TypeExpression db (nullity 'PGinterval)
1715+interval :: TypeExpression schemas (nullity 'PGinterval)
17161716interval = UnsafeTypeExpression "interval"
17171717-- | universally unique identifier
1718−uuid :: TypeExpression db (nullity 'PGuuid)
1718+uuid :: TypeExpression schemas (nullity 'PGuuid)
17191719uuid = UnsafeTypeExpression "uuid"
17201720-- | IPv4 or IPv6 host address
1721−inet :: TypeExpression db (nullity 'PGinet)
1721+inet :: TypeExpression schemas (nullity 'PGinet)
17221722inet = UnsafeTypeExpression "inet"
17231723-- | textual JSON data
1724−json :: TypeExpression db (nullity 'PGjson)
1724+json :: TypeExpression schemas (nullity 'PGjson)
17251725json = UnsafeTypeExpression "json"
17261726-- | binary JSON data, decomposed
1727−jsonb :: TypeExpression db (nullity 'PGjsonb)
1727+jsonb :: TypeExpression schemas (nullity 'PGjsonb)
17281728jsonb = UnsafeTypeExpression "jsonb"
17291729-- | variable length array
17301730vararray
1731− :: TypeExpression db pg
1732− -> TypeExpression db (nullity ('PGvararray pg))
1731+ :: TypeExpression schemas pg
1732+ -> TypeExpression schemas (nullity ('PGvararray pg))
17331733vararray ty = UnsafeTypeExpression $ renderTypeExpression ty <> "[]"
17341734-- | fixed length array
17351735--
17361736-- >>> renderTypeExpression (fixarray @2 json)
17371737-- "json[2]"
17381738fixarray
1739− :: forall n db nullity pg. KnownNat n
1740− => TypeExpression db pg
1741− -> TypeExpression db (nullity ('PGfixarray n pg))
1739+ :: forall n schemas nullity pg. KnownNat n
1740+ => TypeExpression schemas pg
1741+ -> TypeExpression schemas (nullity ('PGfixarray n pg))
17421742fixarray ty = UnsafeTypeExpression $
17431743 renderTypeExpression ty <> "[" <> renderNat @n <> "]"
17441744
17451745-- | `pgtype` is a demoted version of a `PGType`
1746−class PGTyped db (ty :: NullityType) where
1747− pgtype :: TypeExpression db ty
1748−instance PGTyped db (nullity 'PGbool) where pgtype = bool
1749−instance PGTyped db (nullity 'PGint2) where pgtype = int2
1750−instance PGTyped db (nullity 'PGint4) where pgtype = int4
1751−instance PGTyped db (nullity 'PGint8) where pgtype = int8
1752−instance PGTyped db (nullity 'PGnumeric) where pgtype = numeric
1753−instance PGTyped db (nullity 'PGfloat4) where pgtype = float4
1754−instance PGTyped db (nullity 'PGfloat8) where pgtype = float8
1755−instance PGTyped db (nullity 'PGtext) where pgtype = text
1746+class PGTyped schemas (ty :: NullityType) where
1747+ pgtype :: TypeExpression schemas ty
1748+instance PGTyped schemas (nullity 'PGbool) where pgtype = bool
1749+instance PGTyped schemas (nullity 'PGint2) where pgtype = int2
1750+instance PGTyped schemas (nullity 'PGint4) where pgtype = int4
1751+instance PGTyped schemas (nullity 'PGint8) where pgtype = int8
1752+instance PGTyped schemas (nullity 'PGnumeric) where pgtype = numeric
1753+instance PGTyped schemas (nullity 'PGfloat4) where pgtype = float4
1754+instance PGTyped schemas (nullity 'PGfloat8) where pgtype = float8
1755+instance PGTyped schemas (nullity 'PGtext) where pgtype = text
17561756instance (KnownNat n, 1 <= n)
1757− => PGTyped db (nullity ('PGchar n)) where pgtype = char @n
1757+ => PGTyped schemas (nullity ('PGchar n)) where pgtype = char @n
17581758instance (KnownNat n, 1 <= n)
1759− => PGTyped db (nullity ('PGvarchar n)) where pgtype = varchar @n
1760−instance PGTyped db (nullity 'PGbytea) where pgtype = bytea
1761−instance PGTyped db (nullity 'PGtimestamp) where pgtype = timestamp
1762−instance PGTyped db (nullity 'PGtimestamptz) where pgtype = timestampWithTimeZone
1763−instance PGTyped db (nullity 'PGdate) where pgtype = date
1764−instance PGTyped db (nullity 'PGtime) where pgtype = time
1765−instance PGTyped db (nullity 'PGtimetz) where pgtype = timeWithTimeZone
1766−instance PGTyped db (nullity 'PGinterval) where pgtype = interval
1767−instance PGTyped db (nullity 'PGuuid) where pgtype = uuid
1768−instance PGTyped db (nullity 'PGjson) where pgtype = json
1769−instance PGTyped db (nullity 'PGjsonb) where pgtype = jsonb
1770−instance PGTyped db ty
1771− => PGTyped db (nullity ('PGvararray ty)) where
1772− pgtype = vararray (pgtype @db @ty)
1773−instance (KnownNat n, PGTyped db ty)
1774− => PGTyped db (nullity ('PGfixarray n ty)) where
1775− pgtype = fixarray @n (pgtype @db @ty)
1759+ => PGTyped schemas (nullity ('PGvarchar n)) where pgtype = varchar @n
1760+instance PGTyped schemas (nullity 'PGbytea) where pgtype = bytea
1761+instance PGTyped schemas (nullity 'PGtimestamp) where pgtype = timestamp
1762+instance PGTyped schemas (nullity 'PGtimestamptz) where pgtype = timestampWithTimeZone
1763+instance PGTyped schemas (nullity 'PGdate) where pgtype = date
1764+instance PGTyped schemas (nullity 'PGtime) where pgtype = time
1765+instance PGTyped schemas (nullity 'PGtimetz) where pgtype = timeWithTimeZone
1766+instance PGTyped schemas (nullity 'PGinterval) where pgtype = interval
1767+instance PGTyped schemas (nullity 'PGuuid) where pgtype = uuid
1768+instance PGTyped schemas (nullity 'PGjson) where pgtype = json
1769+instance PGTyped schemas (nullity 'PGjsonb) where pgtype = jsonb
1770+instance PGTyped schemas ty
1771+ => PGTyped schemas (nullity ('PGvararray ty)) where
1772+ pgtype = vararray (pgtype @schemas @ty)
1773+instance (KnownNat n, PGTyped schemas ty)
1774+ => PGTyped schemas (nullity ('PGfixarray n ty)) where
1775+ pgtype = fixarray @n (pgtype @schemas @ty)