on 11bcbbb help sign in
rel8/src/Rel8/Statement/Returning.hs
29 lines 917 B history raw
1{-# language GADTs #-}
2{-# language StandaloneKindSignatures #-}
4module Rel8.Statement.Returning
5 ( Returning(..)
6 )
7where
9-- base
10import Data.Int ( Int64 )
11import Data.Kind ( Type )
12import Prelude ()
14-- rel8
15import Rel8.Schema.Name ( Selects )
16import Rel8.Table.Serialize ( Serializable )
19-- | @INSERT@, @UPDATE@ and @DELETE@ all support returning either the number of
20-- rows affected, or the actual rows modified. 'Projection' allows you to
21-- project out of these returned rows, which can be useful if you want to log
22-- exactly which rows were deleted, or to view a generated id (for example, if
23-- using a column with an autoincrementing counter as a default value).
24type Returning :: Type -> Type -> Type
25data Returning names a where
26 NumberOfRowsAffected :: Returning names Int64
27 Projection :: (Selects names exprs, Serializable projection a)
28 => (exprs -> projection)
29 -> Returning names [a]