1{-# language FlexibleContexts #-}
3module Rel8.Query.Rebind
10import Control.Arrow ((<<<))
13import qualified Opaleye.Internal.Rebind as Opaleye
16import Rel8.Expr ( Expr )
17import Rel8.Query ( Query )
18import Rel8.Table ( Table )
19import Rel8.Table.Opaleye ( unpackspec )
20import Rel8.Query.Opaleye (fromOpaleye)
23-- | 'rebind' takes a variable name, some expressions, and binds each of them
24-- to a new variable in the SQL. The @a@ returned consists only of these
25-- variables. It's essentially a @let@ binding for Postgres expressions.
26rebind :: Table Expr a => String -> a -> Query a
27rebind prefix a = fromOpaleye (Opaleye.rebindExplicitPrefix prefix unpackspec <<< pure a)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list