mirror of
https://github.com/nikita-volkov/hasql.git
synced 2024-11-22 18:22:05 +03:00
Levels and Privileges sketch
This commit is contained in:
parent
dfd65582e0
commit
0c28e6ccae
@ -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 ())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user