1{-# language FlexibleContexts #-}
3module Rel8.Query.Values
9import Data.Foldable ( toList )
13import qualified Opaleye.Values as Opaleye
16import {-# SOURCE #-} Rel8.Query ( Query )
17import Rel8.Query.Opaleye ( fromOpaleye )
18import Rel8.Table ( Table )
19import Rel8.Table.Opaleye ( valuesspec )
20import Rel8.Schema.Context ( DB )
23-- | Construct a query that returns the given input list of rows. This is like
24-- folding a list of 'return' statements under 'union', but uses the SQL
25-- @VALUES@ expression for efficiency.
27-- Typically @values@ will be used with 'lit':
29-- >>> mapM_ Data.Text.IO.putStrLn =<< select c (values [ lit "Hello", lit "World!" ])
32values :: (Table DB a, Foldable f) => f a -> Query a
33values = fromOpaleye . Opaleye.valuesExplicit valuesspec . toList
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