Safe Haskell | None |
---|---|
Language | Haskell2010 |
Avers.Types
Synopsis
- class Pk a where
- newtype Path = Path {}
- rootPath :: Path
- newtype ObjId = ObjId {}
- rootObjId :: ObjId
- newtype RevId = RevId {}
- zeroRevId :: RevId
- data ObjectId
- objectIdParser :: Parser ObjectId
- parseObjectId :: Text -> Maybe ObjectId
- objectIdBase :: ObjectId -> ObjId
- data Operation
- data PatchError = UnknownPatchError !Text
- type PatchM a = Either PatchError a
- data Object = Object {
- objectId :: !ObjId
- objectType :: !Text
- objectCreatedAt :: !UTCTime
- objectCreatedBy :: !ObjId
- objectDeleted :: !(Maybe Bool)
- data Patch = Patch {}
- data Snapshot = Snapshot {}
- initialSnapshot :: ObjectId -> Snapshot
- data Release = Release
- newtype SecretId = SecretId {
- unSecretId :: Text
- data Secret = Secret {
- secretId :: !SecretId
- secretValue :: !Text
- newtype BlobId = BlobId {}
- data Blob = Blob {}
- newtype SessionId = SessionId {
- unSessionId :: Text
- data Session = Session {}
- data AversError
- internalError :: AversError -> Avers a
- internal :: Avers a -> Avers a
- databaseError :: Text -> Avers a
- patchError :: PatchError -> Avers a
- parseError :: MonadError AversError m => Value -> Text -> m a
- documentNotFound :: Text -> Avers a
- strErr :: String -> Avers a
- data ObjectType a = ObjectType {}
- data SomeObjectType where
- SomeObjectType :: (ToDatum a, FromDatum a, FromJSON a, ToJSON a) => ObjectType a -> SomeObjectType
- parseValueAs :: FromJSON a => ObjectType a -> Value -> Either AversError a
- data Config = Config {
- databaseURI :: !URI
- putBlob :: BlobId -> Text -> ByteString -> IO (Either AversError ())
- objectTypes :: ![SomeObjectType]
- emitMeasurement :: Measurement -> Double -> IO ()
- data Change = CPatch !Patch
- data Handle = Handle {}
- newtype Avers a = Avers {}
- class Monad m => MonadAvers m where
- evalAvers :: Handle -> Avers a -> IO (Either AversError a)
- data View obj a = View {
- viewName :: Text
- viewParser :: Datum -> Either AversError a
- viewObjectTransformer :: obj -> Avers (Maybe a)
- viewIndices :: [SomeIndex]
- data SomeView obj where
Documentation
Pk - Types which can be converted to a database primary key.
Path
Instances
Eq Path Source # | |
Ord Path Source # | |
Show Path Source # | |
IsString Path Source # | |
Defined in Avers.Types Methods fromString :: String -> Path # | |
Generic Path Source # | |
ToJSON Path Source # | |
Defined in Avers.Types | |
FromJSON Path Source # | |
ToDatum Path Source # | |
Defined in Avers.Types | |
FromDatum Path Source # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Path # | |
type Rep Path Source # | |
Defined in Avers.Types |
This path refers to the root of an object. It is only used in Set
operations.
ObjId
Instances
Eq ObjId Source # | |
Ord ObjId Source # | |
Show ObjId Source # | |
Generic ObjId Source # | |
ToJSON ObjId Source # | |
Defined in Avers.Types | |
FromJSON ObjId Source # | |
ToDatum ObjId Source # | |
Defined in Avers.Types | |
FromDatum ObjId Source # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser ObjId # | |
Pk ObjId Source # | |
type Rep ObjId Source # | |
Defined in Avers.Types |
The root object id is used for object created internally or when there is no applicable creator.
RevId
Instances
Enum RevId Source # | |
Eq RevId Source # | |
Ord RevId Source # | |
Show RevId Source # | |
Generic RevId Source # | |
ToJSON RevId Source # | |
Defined in Avers.Types | |
FromJSON RevId Source # | |
ToDatum RevId Source # | |
Defined in Avers.Types | |
FromDatum RevId Source # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser RevId # | |
Pk RevId Source # | |
type Rep RevId Source # | |
Defined in Avers.Types |
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
objectIdBase :: ObjectId -> ObjId Source #
The operations that can be applied to JSON values.
Constructors
Set | Set is applied to |
Splice | Splice is used to manipulate |
Instances
data PatchError Source #
Constructors
UnknownPatchError !Text |
Instances
Show PatchError Source # | |
Defined in Avers.Types Methods showsPrec :: Int -> PatchError -> ShowS # show :: PatchError -> String # showList :: [PatchError] -> ShowS # | |
Generic PatchError Source # | |
Defined in Avers.Types Associated Types type Rep PatchError :: Type -> Type # | |
type Rep PatchError Source # | |
Defined in Avers.Types type Rep PatchError = D1 ('MetaData "PatchError" "Avers.Types" "avers-0.0.17.1-9kdjlsFObHd4VvDcbnYnDM" 'False) (C1 ('MetaCons "UnknownPatchError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text))) |
type PatchM a = Either PatchError a Source #
Constructors
Object | |
Fields
|
Instances
Patch
Constructors
Patch | |
Fields
|
Instances
Snapshot
Constructors
Snapshot | |
Fields
|
Instances
Show Snapshot Source # | |
Generic Snapshot Source # | |
ToJSON Snapshot Source # | |
Defined in Avers.Types | |
FromJSON Snapshot Source # | |
ToDatum Snapshot Source # | |
Defined in Avers.Types | |
FromDatum Snapshot Source # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Snapshot # | |
Pk Snapshot Source # | |
type Rep Snapshot Source # | |
Defined in Avers.Types type Rep Snapshot = D1 ('MetaData "Snapshot" "Avers.Types" "avers-0.0.17.1-9kdjlsFObHd4VvDcbnYnDM" 'False) (C1 ('MetaCons "Snapshot" 'PrefixI 'True) (S1 ('MetaSel ('Just "snapshotObjectId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ObjectId) :*: (S1 ('MetaSel ('Just "snapshotRevisionId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 RevId) :*: S1 ('MetaSel ('Just "snapshotContent") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Value)))) |
initialSnapshot :: ObjectId -> Snapshot Source #
The initial snapshot on top of which all future patches are applied.
Release
Constructors
Release |
(deriveJSONOptions "release") ''Release)
SecretId
Constructors
SecretId | |
Fields
|
Instances
Show SecretId Source # | |
Generic SecretId Source # | |
ToJSON SecretId Source # | |
Defined in Avers.Types | |
FromJSON SecretId Source # | |
ToDatum SecretId Source # | |
Defined in Avers.Types | |
FromDatum SecretId Source # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser SecretId # | |
Pk SecretId Source # | |
type Rep SecretId Source # | |
Defined in Avers.Types |
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 SecretId
s are unique. If you use ObjId
s
then they by definition are.
Constructors
Secret | |
Fields
|
Instances
Generic Secret Source # | |
ToJSON Secret Source # | |
Defined in Avers.Types | |
FromJSON Secret Source # | |
ToDatum Secret Source # | |
Defined in Avers.Types | |
FromDatum Secret Source # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Secret # | |
Pk Secret Source # | |
type Rep Secret Source # | |
Defined in Avers.Types type Rep Secret = D1 ('MetaData "Secret" "Avers.Types" "avers-0.0.17.1-9kdjlsFObHd4VvDcbnYnDM" 'False) (C1 ('MetaCons "Secret" 'PrefixI 'True) (S1 ('MetaSel ('Just "secretId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SecretId) :*: S1 ('MetaSel ('Just "secretValue") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text))) |
BlobId
Instances
Show BlobId Source # | |
Generic BlobId Source # | |
ToJSON BlobId Source # | |
Defined in Avers.Types | |
FromJSON BlobId Source # | |
ToDatum BlobId Source # | |
Defined in Avers.Types | |
FromDatum BlobId Source # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser BlobId # | |
Pk BlobId Source # | |
type Rep BlobId Source # | |
Defined in Avers.Types |
Blob
Instances
Show Blob Source # | |
Generic Blob Source # | |
ToJSON Blob Source # | |
Defined in Avers.Types | |
FromJSON Blob Source # | |
ToDatum Blob Source # | |
Defined in Avers.Types | |
FromDatum Blob Source # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Blob # | |
Pk Blob Source # | |
type Rep Blob Source # | |
Defined in Avers.Types type Rep Blob = D1 ('MetaData "Blob" "Avers.Types" "avers-0.0.17.1-9kdjlsFObHd4VvDcbnYnDM" 'False) (C1 ('MetaCons "Blob" 'PrefixI 'True) (S1 ('MetaSel ('Just "blobId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 BlobId) :*: (S1 ('MetaSel ('Just "blobSize") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Just "blobContentType") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Text)))) |
SessionId
Constructors
SessionId | |
Fields
|
Instances
Generic SessionId Source # | |
ToJSON SessionId Source # | |
Defined in Avers.Types | |
FromJSON SessionId Source # | |
ToDatum SessionId Source # | |
Defined in Avers.Types | |
FromDatum SessionId Source # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser SessionId # | |
Pk SessionId Source # | |
type Rep SessionId Source # | |
Defined in Avers.Types |
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.
Constructors
Session | |
Fields
|
Instances
Generic Session Source # | |
ToJSON Session Source # | |
Defined in Avers.Types | |
FromJSON Session Source # | |
ToDatum Session Source # | |
Defined in Avers.Types | |
FromDatum Session Source # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Session # | |
Pk Session Source # | |
type Rep Session Source # | |
Defined in Avers.Types type Rep Session = D1 ('MetaData "Session" "Avers.Types" "avers-0.0.17.1-9kdjlsFObHd4VvDcbnYnDM" 'False) (C1 ('MetaCons "Session" 'PrefixI 'True) ((S1 ('MetaSel ('Just "sessionId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SessionId) :*: S1 ('MetaSel ('Just "sessionObjId") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ObjId)) :*: (S1 ('MetaSel ('Just "sessionCreatedAt") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UTCTime) :*: S1 ('MetaSel ('Just "sessionLastAccessedAt") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 UTCTime)))) |
data AversError Source #
Constructors
InternalError !AversError | |
DatabaseError !Text | |
PatchError !PatchError | |
ParseError !Value !Text | |
UnknownObjectType !Text | |
ObjectNotFound !ObjId | |
DocumentNotFound !Text | |
AversError !Text | |
NotAuthorized |
Instances
internalError :: AversError -> Avers a Source #
databaseError :: Text -> Avers a Source #
patchError :: PatchError -> Avers a Source #
parseError :: MonadError AversError m => Value -> Text -> m a Source #
documentNotFound :: Text -> Avers a Source #
data ObjectType a Source #
An ObjectType
describes a particular type of object that is managed by
Avers.
data SomeObjectType where Source #
Constructors
SomeObjectType :: (ToDatum a, FromDatum a, FromJSON a, ToJSON a) => ObjectType a -> SomeObjectType |
parseValueAs :: FromJSON a => ObjectType a -> Value -> Either AversError a Source #
Configuration of the Avers
monad.
Constructors
Config | |
Fields
|
A change in the system, for example a new object, patch, release, blob etc.
Constructors
Handle | |
Fields
|
Instances
Monad Avers Source # | |
Functor Avers Source # | |
Applicative Avers Source # | |
MonadIO Avers Source # | |
Defined in Avers.Types | |
MonadAvers Avers Source # | |
MonadState Handle Avers Source # | |
MonadError AversError Avers Source # | |
Defined in Avers.Types Methods throwError :: AversError -> Avers a # catchError :: Avers a -> (AversError -> Avers a) -> Avers a # |
class Monad m => MonadAvers m where Source #
Instances
MonadAvers Avers Source # | |
MonadAvers m => MonadAvers (StateT s m) Source # | |
Constructors
View | |
Fields
|