mirror of
https://github.com/ilyakooo0/squeal.git
synced 2024-09-17 16:57:22 +03:00
type empty ranges
This commit is contained in:
parent
84df501be6
commit
ffed04248b
@ -80,12 +80,15 @@ import Squeal.PostgreSQL.Schema
|
||||
-- tstzrange(now(), NULL, '[)')
|
||||
-- >>> printSQL $ range numrange (0 <=..< 2*pi)
|
||||
-- numrange(0, (2 * pi()), '[)')
|
||||
-- >>> printSQL $ range int4range Empty
|
||||
-- (empty :: int4range)
|
||||
range
|
||||
:: TypeExpression schemas (null ('PGrange ty))
|
||||
-> Range (Expression outer commons grp schemas params from ('NotNull ty))
|
||||
-> Expression outer commons grp schemas params from (null ('PGrange ty))
|
||||
range ty = \case
|
||||
Empty -> UnsafeExpression "empty"
|
||||
Empty -> UnsafeExpression $ parenthesized
|
||||
("empty" <+> "::" <+> renderSQL ty)
|
||||
NonEmpty l u -> UnsafeExpression $ renderSQL ty <> parenthesized
|
||||
(commaSeparated [renderArg l, renderArg u, renderClopen l u])
|
||||
where
|
||||
|
Loading…
Reference in New Issue
Block a user