on dev help sign in
type empty ranges
ffed042Eitan Chatav
squeal-postgresql/src/Squeal/PostgreSQL/Expression/Range.hs+4−1
@@ -80,12 +80,15 @@ import Squeal.PostgreSQL.Schema
80-- tstzrange(now(), NULL, '[)')
80-- tstzrange(now(), NULL, '[)')
81-- >>> printSQL $ range numrange (0 <=..< 2*pi)
81-- >>> printSQL $ range numrange (0 <=..< 2*pi)
82-- numrange(0, (2 * pi()), '[)')
82-- numrange(0, (2 * pi()), '[)')
83+-- >>> printSQL $ range int4range Empty
84+-- (empty :: int4range)
83range
85range
84 :: TypeExpression schemas (null ('PGrange ty))
86 :: TypeExpression schemas (null ('PGrange ty))
85 -> Range (Expression outer commons grp schemas params from ('NotNull ty))
87 -> Range (Expression outer commons grp schemas params from ('NotNull ty))
86 -> Expression outer commons grp schemas params from (null ('PGrange ty))
88 -> Expression outer commons grp schemas params from (null ('PGrange ty))
87range ty = \case
89range ty = \case
88− Empty -> UnsafeExpression "empty"
90+ Empty -> UnsafeExpression $ parenthesized
91+ ("empty" <+> "::" <+> renderSQL ty)
89 NonEmpty l u -> UnsafeExpression $ renderSQL ty <> parenthesized
92 NonEmpty l u -> UnsafeExpression $ renderSQL ty <> parenthesized
90 (commaSeparated [renderArg l, renderArg u, renderClopen l u])
93 (commaSeparated [renderArg l, renderArg u, renderClopen l u])
91 where
94 where