1{-# language MonoLocalBinds #-}
2{-# language NamedFieldPuns #-}
4module Rel8.Statement.Set
10import Data.Foldable ( toList )
14import qualified Opaleye.Internal.HaskellDB.Sql.Print as Opaleye
15import qualified Opaleye.Internal.Sql as Opaleye
18import Text.PrettyPrint ( Doc, (<+>), equals, text )
21import Rel8.Schema.Name ( Selects, ppColumn )
22import Rel8.Schema.Table ( TableSchema(..) )
23import Rel8.Table.Opaleye ( attributes, exprsWithNames )
26ppSet :: Selects names exprs
27 => TableSchema names -> (exprs -> exprs) -> Doc
28ppSet schema@TableSchema {columns} f =
29 text "SET" <+> Opaleye.commaV ppAssign (toList assigns)
31 assigns = exprsWithNames columns (f (attributes schema))
32 ppAssign (column, expr) =
33 ppColumn column <+> equals <+> Opaleye.ppSqlExpr (Opaleye.sqlExpr expr)
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