avers-0.0.17.1: Server-side implementation of the Avers storage model

Safe HaskellNone
LanguageHaskell2010

Avers.Types

Synopsis

Documentation

class Pk a where #

Pk - Types which can be converted to a database primary key.

Minimal complete definition

toPk

Methods

toPk :: a -> Text #

Instances

Pk Text # 

Methods

toPk :: Text -> Text #

Pk ObjectId # 

Methods

toPk :: ObjectId -> Text #

Pk RevId # 

Methods

toPk :: RevId -> Text #

Pk ObjId # 

Methods

toPk :: ObjId -> Text #

Pk Object # 

Methods

toPk :: Object -> Text #

Pk Patch # 

Methods

toPk :: Patch -> Text #

Pk Snapshot # 

Methods

toPk :: Snapshot -> Text #

Pk Secret # 

Methods

toPk :: Secret -> Text #

Pk SecretId # 

Methods

toPk :: SecretId -> Text #

Pk Blob # 

Methods

toPk :: Blob -> Text #

Pk BlobId # 

Methods

toPk :: BlobId -> Text #

Pk Session # 

Methods

toPk :: Session -> Text #

Pk SessionId # 

Methods

toPk :: SessionId -> Text #

Pk (Record a) # 

Methods

toPk :: Record a -> Text #

newtype Path #

Path

Constructors

Path 

Fields

Instances

Eq Path # 

Methods

(==) :: Path -> Path -> Bool #

(/=) :: Path -> Path -> Bool #

Ord Path # 

Methods

compare :: Path -> Path -> Ordering #

(<) :: Path -> Path -> Bool #

(<=) :: Path -> Path -> Bool #

(>) :: Path -> Path -> Bool #

(>=) :: Path -> Path -> Bool #

max :: Path -> Path -> Path #

min :: Path -> Path -> Path #

Show Path # 

Methods

showsPrec :: Int -> Path -> ShowS #

show :: Path -> String #

showList :: [Path] -> ShowS #

IsString Path # 

Methods

fromString :: String -> Path #

Generic Path # 

Associated Types

type Rep Path :: * -> * #

Methods

from :: Path -> Rep Path x #

to :: Rep Path x -> Path #

ToJSON Path # 
FromJSON Path # 
ToDatum Path # 

Methods

toDatum :: Path -> Datum #

FromDatum Path # 
type Rep Path # 
type Rep Path = D1 (MetaData "Path" "Avers.Types" "avers-0.0.17.1-GXLwK1SQtx5ExJULyYRYIy" True) (C1 (MetaCons "Path" PrefixI True) (S1 (MetaSel (Just Symbol "unPath") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

rootPath :: Path #

This path refers to the root of an object. It is only used in Set operations.

newtype ObjId #

ObjId

Constructors

ObjId 

Fields

Instances

Eq ObjId # 

Methods

(==) :: ObjId -> ObjId -> Bool #

(/=) :: ObjId -> ObjId -> Bool #

Ord ObjId # 

Methods

compare :: ObjId -> ObjId -> Ordering #

(<) :: ObjId -> ObjId -> Bool #

(<=) :: ObjId -> ObjId -> Bool #

(>) :: ObjId -> ObjId -> Bool #

(>=) :: ObjId -> ObjId -> Bool #

max :: ObjId -> ObjId -> ObjId #

min :: ObjId -> ObjId -> ObjId #

Show ObjId # 

Methods

showsPrec :: Int -> ObjId -> ShowS #

show :: ObjId -> String #

showList :: [ObjId] -> ShowS #

Generic ObjId # 

Associated Types

type Rep ObjId :: * -> * #

Methods

from :: ObjId -> Rep ObjId x #

to :: Rep ObjId x -> ObjId #

ToJSON ObjId # 
FromJSON ObjId # 
ToDatum ObjId # 

Methods

toDatum :: ObjId -> Datum #

FromDatum ObjId # 
Pk ObjId # 

Methods

toPk :: ObjId -> Text #

type Rep ObjId # 
type Rep ObjId = D1 (MetaData "ObjId" "Avers.Types" "avers-0.0.17.1-GXLwK1SQtx5ExJULyYRYIy" True) (C1 (MetaCons "ObjId" PrefixI True) (S1 (MetaSel (Just Symbol "unObjId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

rootObjId :: ObjId #

The root object id is used for object created internally or when there is no applicable creator.

newtype RevId #

RevId

Constructors

RevId 

Fields

Instances

Enum RevId # 
Eq RevId # 

Methods

(==) :: RevId -> RevId -> Bool #

(/=) :: RevId -> RevId -> Bool #

Ord RevId # 

Methods

compare :: RevId -> RevId -> Ordering #

(<) :: RevId -> RevId -> Bool #

(<=) :: RevId -> RevId -> Bool #

(>) :: RevId -> RevId -> Bool #

(>=) :: RevId -> RevId -> Bool #

max :: RevId -> RevId -> RevId #

min :: RevId -> RevId -> RevId #

Show RevId # 

Methods

showsPrec :: Int -> RevId -> ShowS #

show :: RevId -> String #

showList :: [RevId] -> ShowS #

Generic RevId # 

Associated Types

type Rep RevId :: * -> * #

Methods

from :: RevId -> Rep RevId x #

to :: Rep RevId x -> RevId #

ToJSON RevId # 
FromJSON RevId # 
ToDatum RevId # 

Methods

toDatum :: RevId -> Datum #

FromDatum RevId # 
Pk RevId # 

Methods

toPk :: RevId -> Text #

type Rep RevId # 
type Rep RevId = D1 (MetaData "RevId" "Avers.Types" "avers-0.0.17.1-GXLwK1SQtx5ExJULyYRYIy" True) (C1 (MetaCons "RevId" PrefixI True) (S1 (MetaSel (Just Symbol "unRevId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

zeroRevId :: RevId #

The RevId which is used for the initial snapshot.

data ObjectId #

ObjectId

Constructors

BaseObjectId !ObjId

The base object whose snapshots contain the actual content.

ReleaseObjectId !ObjId !RevId

An object describing a particualar release of the base object.

AuthorizationObjectId !ObjId

Object which contains authorization rules.

Instances

Eq ObjectId # 
Ord ObjectId # 
Show ObjectId # 
Generic ObjectId # 

Associated Types

type Rep ObjectId :: * -> * #

Methods

from :: ObjectId -> Rep ObjectId x #

to :: Rep ObjectId x -> ObjectId #

ToJSON ObjectId # 
FromJSON ObjectId # 
ToDatum ObjectId # 

Methods

toDatum :: ObjectId -> Datum #

FromDatum ObjectId # 
Pk ObjectId # 

Methods

toPk :: ObjectId -> Text #

type Rep ObjectId # 

data Operation #

The operations that can be applied to JSON values.

Constructors

Set

Set is applied to Objects. It is used for adding, updating and deleting properties from the object.

Fields

Splice

Splice is used to manipulate Arrays. It can remove and insert multiple elements in a single operation.

Fields

Instances

Eq Operation # 
Show Operation # 
Generic Operation # 

Associated Types

type Rep Operation :: * -> * #

ToJSON Operation # 
FromJSON Operation # 
ToDatum Operation # 

Methods

toDatum :: Operation -> Datum #

FromDatum Operation # 
type Rep Operation # 

data PatchError #

Constructors

UnknownPatchError !Text 

Instances

Show PatchError # 
Generic PatchError # 

Associated Types

type Rep PatchError :: * -> * #

type Rep PatchError # 
type Rep PatchError = D1 (MetaData "PatchError" "Avers.Types" "avers-0.0.17.1-GXLwK1SQtx5ExJULyYRYIy" False) (C1 (MetaCons "UnknownPatchError" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)))

data Object #

data Patch #

Patch

initialSnapshot :: ObjectId -> Snapshot #

The initial snapshot on top of which all future patches are applied.

(deriveJSONOptions "release") ''Release)

newtype SecretId #

SecretId

Constructors

SecretId 

Fields

Instances

Show SecretId # 
Generic SecretId # 

Associated Types

type Rep SecretId :: * -> * #

Methods

from :: SecretId -> Rep SecretId x #

to :: Rep SecretId x -> SecretId #

ToJSON SecretId # 
FromJSON SecretId # 
ToDatum SecretId # 

Methods

toDatum :: SecretId -> Datum #

FromDatum SecretId # 
Pk SecretId # 

Methods

toPk :: SecretId -> Text #

type Rep SecretId # 
type Rep SecretId = D1 (MetaData "SecretId" "Avers.Types" "avers-0.0.17.1-GXLwK1SQtx5ExJULyYRYIy" True) (C1 (MetaCons "SecretId" PrefixI True) (S1 (MetaSel (Just Symbol "unSecretId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data Secret #

Secret

A Secret is a password (encrypted with scrypt) that is attached to a SecretId (for example the ObjId of an account).

It is up to you to ensure that SecretIds are unique. If you use ObjIds then they by definition are.

Constructors

Secret 

Instances

Generic Secret # 

Associated Types

type Rep Secret :: * -> * #

Methods

from :: Secret -> Rep Secret x #

to :: Rep Secret x -> Secret #

ToJSON Secret # 
FromJSON Secret # 
ToDatum Secret # 

Methods

toDatum :: Secret -> Datum #

FromDatum Secret # 
Pk Secret # 

Methods

toPk :: Secret -> Text #

type Rep Secret # 
type Rep Secret = D1 (MetaData "Secret" "Avers.Types" "avers-0.0.17.1-GXLwK1SQtx5ExJULyYRYIy" False) (C1 (MetaCons "Secret" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "secretId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 SecretId)) (S1 (MetaSel (Just Symbol "secretValue") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text))))

newtype BlobId #

BlobId

Constructors

BlobId 

Fields

Instances

Show BlobId # 
Generic BlobId # 

Associated Types

type Rep BlobId :: * -> * #

Methods

from :: BlobId -> Rep BlobId x #

to :: Rep BlobId x -> BlobId #

ToJSON BlobId # 
FromJSON BlobId # 
ToDatum BlobId # 

Methods

toDatum :: BlobId -> Datum #

FromDatum BlobId # 
Pk BlobId # 

Methods

toPk :: BlobId -> Text #

type Rep BlobId # 
type Rep BlobId = D1 (MetaData "BlobId" "Avers.Types" "avers-0.0.17.1-GXLwK1SQtx5ExJULyYRYIy" True) (C1 (MetaCons "BlobId" PrefixI True) (S1 (MetaSel (Just Symbol "unBlobId") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Text)))

data Blob #

Blob

Constructors

Blob 

Instances

Show Blob # 

Methods

showsPrec :: Int -> Blob -> ShowS #

show :: Blob -> String #

showList :: [Blob] -> ShowS #

Generic Blob # 

Associated Types

type Rep Blob :: * -> * #

Methods

from :: Blob -> Rep Blob x #

to :: Rep Blob x -> Blob #

ToJSON Blob # 
FromJSON Blob # 
ToDatum Blob # 

Methods

toDatum :: Blob -> Datum #

FromDatum Blob # 
Pk Blob # 

Methods

toPk :: Blob -> Text #

type Rep Blob # 
type Rep Blob = D1 (MetaData "Blob" "Avers.Types" "avers-0.0.17.1-GXLwK1SQtx5ExJULyYRYIy" False) (C1 (MetaCons "Blob" PrefixI True) ((:*:) (S1 (MetaSel (Just Symbol "blobId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 BlobId)) ((:*:) (S1 (MetaSel (Just Symbol "blobSize") NoSourceUnpackedness SourceStrict DecidedUnpack) (Rec0 Int)) (S1 (MetaSel (Just Symbol "blobContentType") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)))))

newtype SessionId #

SessionId

Constructors

SessionId 

Fields

Instances

data Session #

The session record that is stored in the database.

A session is a unique identifier attached to a particular object. It contains the creation date and when it was last accessed. If you need to store additional data for a session, we recommend to use cookies.

data AversError #

Instances

Show AversError # 
Generic AversError # 

Associated Types

type Rep AversError :: * -> * #

MonadError AversError Avers # 

Methods

throwError :: AversError -> Avers a #

catchError :: Avers a -> (AversError -> Avers a) -> Avers a #

type Rep AversError # 

internal :: Avers a -> Avers a #

data ObjectType a #

An ObjectType describes a particular type of object that is managed by Avers.

Constructors

ObjectType 

Fields

data SomeObjectType where #

data Config #

Configuration of the Avers monad.

Constructors

Config 

Fields

data Change #

A change in the system, for example a new object, patch, release, blob etc.

Constructors

CPatch !Patch

A new patch was created.

Instances

Show Change # 
Generic Change # 

Associated Types

type Rep Change :: * -> * #

Methods

from :: Change -> Rep Change x #

to :: Rep Change x -> Change #

ToJSON Change # 
type Rep Change # 
type Rep Change = D1 (MetaData "Change" "Avers.Types" "avers-0.0.17.1-GXLwK1SQtx5ExJULyYRYIy" False) (C1 (MetaCons "CPatch" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Patch)))

data Handle #

Constructors

Handle 

Fields

Instances

MonadState Handle Avers # 

Methods

get :: Avers Handle #

put :: Handle -> Avers () #

state :: (Handle -> (a, Handle)) -> Avers a #

newtype Avers a #

Constructors

Avers 

Instances

Monad Avers # 

Methods

(>>=) :: Avers a -> (a -> Avers b) -> Avers b #

(>>) :: Avers a -> Avers b -> Avers b #

return :: a -> Avers a #

fail :: String -> Avers a #

Functor Avers # 

Methods

fmap :: (a -> b) -> Avers a -> Avers b #

(<$) :: a -> Avers b -> Avers a #

Applicative Avers # 

Methods

pure :: a -> Avers a #

(<*>) :: Avers (a -> b) -> Avers a -> Avers b #

(*>) :: Avers a -> Avers b -> Avers b #

(<*) :: Avers a -> Avers b -> Avers a #

MonadIO Avers # 

Methods

liftIO :: IO a -> Avers a #

MonadAvers Avers # 

Methods

liftAvers :: Avers a -> Avers a #

MonadError AversError Avers # 

Methods

throwError :: AversError -> Avers a #

catchError :: Avers a -> (AversError -> Avers a) -> Avers a #

MonadState Handle Avers # 

Methods

get :: Avers Handle #

put :: Handle -> Avers () #

state :: (Handle -> (a, Handle)) -> Avers a #

class Monad m => MonadAvers m where #

Minimal complete definition

liftAvers

Methods

liftAvers :: Avers a -> m a #

Instances

MonadAvers Avers # 

Methods

liftAvers :: Avers a -> Avers a #

MonadAvers m => MonadAvers (StateT s m) # 

Methods

liftAvers :: Avers a -> StateT s m a #

data View obj a #

Constructors

View 

Fields

data SomeView obj where #

Constructors

SomeView :: (ToDatum a, FromDatum a, FromJSON obj, ToJSON a) => View obj a -> SomeView obj