Safe Haskell | Safe |
---|
- class DCRecord a where
- fromDocument :: Monad m => Document DCLabel -> m a
- toDocument :: a -> Document DCLabel
- collectionName :: a -> CollectionName
- findBy :: (Val DCLabel v, DatabasePolicy p) => p -> CollectionName -> Key -> v -> DC (Maybe a)
- findWhere :: DatabasePolicy p => p -> Query DCLabel -> DC (Maybe a)
- insertRecord :: DatabasePolicy p => p -> a -> DC (Either Failure (Value DCLabel))
- saveRecord :: DatabasePolicy p => p -> a -> DC (Either Failure ())
- deleteBy :: (Val DCLabel v, DatabasePolicy p) => p -> CollectionName -> Key -> v -> DC (Maybe a)
- deleteWhere :: DatabasePolicy p => p -> Selection DCLabel -> DC (Maybe a)
- findByP :: (Val DCLabel v, DatabasePolicy p) => DCPrivTCB -> p -> CollectionName -> Key -> v -> DC (Maybe a)
- findWhereP :: DatabasePolicy p => DCPrivTCB -> p -> Query DCLabel -> DC (Maybe a)
- insertRecordP :: DatabasePolicy p => DCPrivTCB -> p -> a -> DC (Either Failure (Value DCLabel))
- saveRecordP :: DatabasePolicy p => DCPrivTCB -> p -> a -> DC (Either Failure ())
- deleteByP :: (Val DCLabel v, DatabasePolicy p) => DCPrivTCB -> p -> CollectionName -> Key -> v -> DC (Maybe a)
- deleteWhereP :: DatabasePolicy p => DCPrivTCB -> p -> Selection DCLabel -> DC (Maybe a)
- class DCRecord a => DCLabeledRecord a where
- insertLabeledRecord :: MkToLabeledDocument p => p -> DCLabeled a -> DC (Either Failure (Value DCLabel))
- saveLabeledRecord :: MkToLabeledDocument p => p -> DCLabeled a -> DC (Either Failure ())
- insertLabeledRecordP :: MkToLabeledDocument p => DCPrivTCB -> p -> DCLabeled a -> DC (Either Failure (Value DCLabel))
- saveLabeledRecordP :: MkToLabeledDocument p => DCPrivTCB -> p -> DCLabeled a -> DC (Either Failure ())
- class DatabasePolicy p => MkToLabeledDocument p where
- toDocumentP :: DCRecord a => DCPrivTCB -> DCLabeled a -> DC (DCLabeled (Document DCLabel))
Documentation
Class for converting from "structured" records to documents (and vice versa).
fromDocument :: Monad m => Document DCLabel -> m aSource
Convert a document to a record
toDocument :: a -> Document DCLabelSource
Convert a record to a document
collectionName :: a -> CollectionNameSource
Get the collection name for the record
findBy :: (Val DCLabel v, DatabasePolicy p) => p -> CollectionName -> Key -> v -> DC (Maybe a)Source
Find an object with mathing value for the given key. If the
object does exist but cannot be read (above clearance), this
returns Nothing
.
findWhere :: DatabasePolicy p => p -> Query DCLabel -> DC (Maybe a)Source
Find an object with given query
insertRecord :: DatabasePolicy p => p -> a -> DC (Either Failure (Value DCLabel))Source
Insert a record into the database
saveRecord :: DatabasePolicy p => p -> a -> DC (Either Failure ())Source
Insert a record into the database
deleteBy :: (Val DCLabel v, DatabasePolicy p) => p -> CollectionName -> Key -> v -> DC (Maybe a)Source
Delete a record from the database given a matching value for given key. The deleted record is returned.
deleteWhere :: DatabasePolicy p => p -> Selection DCLabel -> DC (Maybe a)Source
Delete an object matching the given query. The deleted record is returned.
findByP :: (Val DCLabel v, DatabasePolicy p) => DCPrivTCB -> p -> CollectionName -> Key -> v -> DC (Maybe a)Source
Same as findBy
, but using explicit privileges.
findWhereP :: DatabasePolicy p => DCPrivTCB -> p -> Query DCLabel -> DC (Maybe a)Source
Same as findWhere
, but using explicit privileges.
insertRecordP :: DatabasePolicy p => DCPrivTCB -> p -> a -> DC (Either Failure (Value DCLabel))Source
Same as insertRecord
, but using explicit privileges.
saveRecordP :: DatabasePolicy p => DCPrivTCB -> p -> a -> DC (Either Failure ())Source
Same as saveRecord
, but using explicit privileges.
deleteByP :: (Val DCLabel v, DatabasePolicy p) => DCPrivTCB -> p -> CollectionName -> Key -> v -> DC (Maybe a)Source
Same as deleteBy
, but using explicit privileges.
deleteWhereP :: DatabasePolicy p => DCPrivTCB -> p -> Selection DCLabel -> DC (Maybe a)Source
Same as deleteWhere
, but using explicit privileges.
class DCRecord a => DCLabeledRecord a whereSource
Class for inserting and saving labeled records.
insertLabeledRecord :: MkToLabeledDocument p => p -> DCLabeled a -> DC (Either Failure (Value DCLabel))Source
Insert a labeled record into the database
saveLabeledRecord :: MkToLabeledDocument p => p -> DCLabeled a -> DC (Either Failure ())Source
Insert a labeled record into the database
insertLabeledRecordP :: MkToLabeledDocument p => DCPrivTCB -> p -> DCLabeled a -> DC (Either Failure (Value DCLabel))Source
Same as insertLabeledRecord
, but using explicit privileges.
saveLabeledRecordP :: MkToLabeledDocument p => DCPrivTCB -> p -> DCLabeled a -> DC (Either Failure ())Source
Same as saveLabeledRecord
, but using explicit privileges.
class DatabasePolicy p => MkToLabeledDocument p whereSource
Classe used by a database policy to translate a labeled record to a labeled document.
mkToLabeledDocument :: DCRecord a => p -> DCLabeled a -> DC (DCLabeled (Document DCLabel))Source
Given a policy, return a function that can be used to translate
labeled records to labeled documents. It is recommended to simply
create the instance by defining mkToDocumentP
as:
mkToDocumentP (Policy ... priv ..) = toDocumentP priv
toDocumentP :: DCRecord a => DCPrivTCB -> DCLabeled a -> DC (DCLabeled (Document DCLabel))Source
Same as toDocument
but for uses the policy's privileges to
convert a labeled record to a labeled document.