@@ -188,22 +188,18 @@ project
188 -> Projection ps xs ys
188 -> Projection ps xs ys
189project = UnsafeProjection . renderAllAliased renderExpression
189project = UnsafeProjection . renderAllAliased renderExpression
191−data Tabulation ps xss xs = UnsafeTabulation
191+data Relation ps xss xs = UnsafeRelation
192− { renderTabulation :: ByteString }
192+ { relation :: ByteString
194−data Relation ps xss xs = Relation
195− { tabulation :: Tabulation ps xss xs
196 , restriction :: Maybe (Expression ps xs 'PGBool)
193 , restriction :: Maybe (Expression ps xs 'PGBool)
197 , limitation :: Maybe (Expression ps '[] 'PGInt8)
194 , limitation :: Maybe (Expression ps '[] 'PGInt8)
198 , offsetting :: Maybe (Expression ps '[] 'PGInt8)
195 , offsetting :: Maybe (Expression ps '[] 'PGInt8)
201renderRelation :: Relation ps xss xs -> ByteString
198renderRelation :: Relation ps xss xs -> ByteString
202−renderRelation (Relation tab wh lim off) =
199+renderRelation (UnsafeRelation rel wh lim off) = rel
203− renderTabulation tab
204− <> maybe "" ((" WHERE " <>) . renderExpression) wh
200+ <> maybe "" ((" WHERE " <>) . renderExpression) wh
205− <> maybe "" ((" LIMIT " <>) . renderExpression) lim
201+ <> maybe "" ((" LIMIT " <>) . renderExpression) lim
206− <> maybe "" ((" OFFSET " <>) . renderExpression) off
202+ <> maybe "" ((" OFFSET " <>) . renderExpression) off
209 :: Relation ps xss xs
205 :: Relation ps xss xs
@@ -237,9 +233,8 @@ ys `offset` n = ys
238instance HasField label xss xs
234instance HasField label xss xs
239 => IsLabel label (Relation ps xss xs) where
235 => IsLabel label (Relation ps xss xs) where
240− fromLabel _ = Relation
236+ fromLabel _ = UnsafeRelation
241− { tabulation = UnsafeTabulation $
242− fieldName (Proxy @label) (Proxy @xss) (Proxy @xs)
237+ { relation = fieldName (Proxy @label) (Proxy @xss) (Proxy @xs)
243 , restriction = Nothing
238 , restriction = Nothing
244 , limitation = Nothing
239 , limitation = Nothing
245 , offsetting = Nothing
240 , offsetting = Nothing
@@ -253,8 +248,8 @@ ys `from` xs = UnsafeSelection $
253 renderProjection ys <> " FROM " <> renderRelation xs
248 renderProjection ys <> " FROM " <> renderRelation xs
255subselect :: Selection ps xss ys -> Relation ps xss ys
250subselect :: Selection ps xss ys -> Relation ps xss ys
256−subselect selection = Relation
251+subselect selection = UnsafeRelation
257− { tabulation = UnsafeTabulation $ "SELECT " <> renderSelection selection
252+ { relation = "SELECT " <> renderSelection selection
258 , restriction = Nothing
253 , restriction = Nothing
259 , limitation = Nothing
254 , limitation = Nothing
260 , offsetting = Nothing
255 , offsetting = Nothing