Levels and Privileges sketch

This commit is contained in:
Nikita Volkov 2014-08-03 20:16:17 +04:00
parent dfd65582e0
commit 0c28e6ccae

View File

@ -2,6 +2,7 @@ module HighSQL where
import HighSQL.Prelude hiding (read, Read, write, Write)
import qualified HighSQL.Backend as Backend
import qualified HighSQL.CompositionT as CompositionT
import qualified Data.Pool as Pool
@ -16,3 +17,58 @@ type S =
session :: Backend.Backend -> S m r -> m r
session b s =
$notImplemented
-- * Transactions
-------------------------
-- |
-- A transaction with a level @l@ and a result @r@.
data T l r
-- ** Privileges
-------------------------
class SelectPrivilege l
select :: SelectPrivilege l => Select r -> T l r
select =
$notImplemented
class UpdatePrivilege l
update :: UpdatePrivilege l => Update -> T l ()
update =
$notImplemented
-- class AlterPrivilege p where
-- alter :: Alter -> T p ()
-- ** Levels
-------------------------
data Read
instance SelectPrivilege Read
data Write
instance SelectPrivilege Write
instance UpdatePrivilege Write
data Admin
-- * Statements
-------------------------
newtype Select r =
Select (Backend.Connection -> IO r)
newtype Update =
Update (Backend.Connection -> IO ())