| 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.
Instances
| Pk Text # | |
Defined in Avers.Types | |
| Pk ObjectId # | |
Defined in Avers.Types | |
| Pk RevId # | |
Defined in Avers.Types | |
| Pk ObjId # | |
Defined in Avers.Types | |
| Pk Object # | |
Defined in Avers.Types | |
| Pk Patch # | |
Defined in Avers.Types | |
| Pk Snapshot # | |
Defined in Avers.Types | |
| Pk Secret # | |
Defined in Avers.Types | |
| Pk SecretId # | |
Defined in Avers.Types | |
| Pk Blob # | |
Defined in Avers.Types | |
| Pk BlobId # | |
Defined in Avers.Types | |
| Pk Session # | |
Defined in Avers.Types | |
| Pk SessionId # | |
Defined in Avers.Types | |
| Pk (Record a) # | |
Defined in Avers.Views | |
Path
Instances
| Eq Path # | |
| Ord Path # | |
| Show Path # | |
| IsString Path # | |
Defined in Avers.Types Methods fromString :: String -> Path # | |
| Generic Path # | |
| ToJSON Path # | |
Defined in Avers.Types | |
| FromJSON Path # | |
| ToDatum Path # | |
Defined in Avers.Types | |
| FromDatum Path # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Path # | |
| type Rep Path # | |
Defined in Avers.Types | |
ObjId
Instances
| Eq ObjId # | |
| Ord ObjId # | |
| Show ObjId # | |
| Generic ObjId # | |
| ToJSON ObjId # | |
Defined in Avers.Types | |
| FromJSON ObjId # | |
| ToDatum ObjId # | |
Defined in Avers.Types | |
| FromDatum ObjId # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser ObjId # | |
| Pk ObjId # | |
Defined in Avers.Types | |
| type Rep ObjId # | |
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 # | |
| Eq RevId # | |
| Ord RevId # | |
| Show RevId # | |
| Generic RevId # | |
| ToJSON RevId # | |
Defined in Avers.Types | |
| FromJSON RevId # | |
| ToDatum RevId # | |
Defined in Avers.Types | |
| FromDatum RevId # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser RevId # | |
| Pk RevId # | |
Defined in Avers.Types | |
| type Rep RevId # | |
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
parseObjectId :: Text -> Maybe ObjectId #
objectIdBase :: ObjectId -> ObjId #
The operations that can be applied to JSON values.
Constructors
| Set | Set is applied to |
| Splice | Splice is used to manipulate |
Instances
data PatchError #
Constructors
| UnknownPatchError !Text |
Instances
| Show PatchError # | |
Defined in Avers.Types Methods showsPrec :: Int -> PatchError -> ShowS # show :: PatchError -> String # showList :: [PatchError] -> ShowS # | |
| Generic PatchError # | |
Defined in Avers.Types Associated Types type Rep PatchError :: Type -> Type # | |
| type Rep PatchError # | |
Defined in Avers.Types type Rep PatchError = D1 (MetaData "PatchError" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" False) (C1 (MetaCons "UnknownPatchError" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text))) | |
type PatchM a = Either PatchError a #
Constructors
| Object | |
Fields
| |
Instances
| Show Object # | |
| Generic Object # | |
| ToJSON Object # | |
Defined in Avers.Types | |
| FromJSON Object # | |
| ToDatum Object # | |
Defined in Avers.Types | |
| FromDatum Object # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Object # | |
| Pk Object # | |
Defined in Avers.Types | |
| type Rep Object # | |
Defined in Avers.Types type Rep Object = D1 (MetaData "Object" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" False) (C1 (MetaCons "Object" PrefixI True) ((S1 (MetaSel (Just "objectId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ObjId) :*: S1 (MetaSel (Just "objectType") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Text)) :*: (S1 (MetaSel (Just "objectCreatedAt") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UTCTime) :*: (S1 (MetaSel (Just "objectCreatedBy") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ObjId) :*: S1 (MetaSel (Just "objectDeleted") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 (Maybe Bool)))))) | |
Patch
Constructors
| Patch | |
Fields
| |
Instances
| Show Patch # | |
| Generic Patch # | |
| ToJSON Patch # | |
Defined in Avers.Types | |
| FromJSON Patch # | |
| ToDatum Patch # | |
Defined in Avers.Types | |
| FromDatum Patch # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Patch # | |
| Pk Patch # | |
Defined in Avers.Types | |
| type Rep Patch # | |
Defined in Avers.Types type Rep Patch = D1 (MetaData "Patch" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" False) (C1 (MetaCons "Patch" PrefixI True) ((S1 (MetaSel (Just "patchObjectId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ObjectId) :*: S1 (MetaSel (Just "patchRevisionId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 RevId)) :*: (S1 (MetaSel (Just "patchAuthorId") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 ObjId) :*: (S1 (MetaSel (Just "patchCreatedAt") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 UTCTime) :*: S1 (MetaSel (Just "patchOperation") NoSourceUnpackedness SourceStrict DecidedStrict) (Rec0 Operation))))) | |
Snapshot
Constructors
| Snapshot | |
Fields
| |
Instances
| Show Snapshot # | |
| Generic Snapshot # | |
| ToJSON Snapshot # | |
Defined in Avers.Types | |
| FromJSON Snapshot # | |
| ToDatum Snapshot # | |
Defined in Avers.Types | |
| FromDatum Snapshot # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Snapshot # | |
| Pk Snapshot # | |
Defined in Avers.Types | |
| type Rep Snapshot # | |
Defined in Avers.Types type Rep Snapshot = D1 (MetaData "Snapshot" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" 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 #
The initial snapshot on top of which all future patches are applied.
(deriveJSONOptions "release") ''Release)
SecretId
Constructors
| SecretId | |
Fields
| |
Instances
| Show SecretId # | |
| Generic SecretId # | |
| ToJSON SecretId # | |
Defined in Avers.Types | |
| FromJSON SecretId # | |
| ToDatum SecretId # | |
Defined in Avers.Types | |
| FromDatum SecretId # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser SecretId # | |
| Pk SecretId # | |
Defined in Avers.Types | |
| type Rep SecretId # | |
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 SecretIds are unique. If you use ObjIds
then they by definition are.
Constructors
| Secret | |
Fields
| |
Instances
| Generic Secret # | |
| ToJSON Secret # | |
Defined in Avers.Types | |
| FromJSON Secret # | |
| ToDatum Secret # | |
Defined in Avers.Types | |
| FromDatum Secret # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Secret # | |
| Pk Secret # | |
Defined in Avers.Types | |
| type Rep Secret # | |
Defined in Avers.Types type Rep Secret = D1 (MetaData "Secret" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" 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 # | |
| Generic BlobId # | |
| ToJSON BlobId # | |
Defined in Avers.Types | |
| FromJSON BlobId # | |
| ToDatum BlobId # | |
Defined in Avers.Types | |
| FromDatum BlobId # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser BlobId # | |
| Pk BlobId # | |
Defined in Avers.Types | |
| type Rep BlobId # | |
Defined in Avers.Types | |
Blob
Instances
| Show Blob # | |
| Generic Blob # | |
| ToJSON Blob # | |
Defined in Avers.Types | |
| FromJSON Blob # | |
| ToDatum Blob # | |
Defined in Avers.Types | |
| FromDatum Blob # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Blob # | |
| Pk Blob # | |
Defined in Avers.Types | |
| type Rep Blob # | |
Defined in Avers.Types type Rep Blob = D1 (MetaData "Blob" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" 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 # | |
| ToJSON SessionId # | |
Defined in Avers.Types | |
| FromJSON SessionId # | |
| ToDatum SessionId # | |
Defined in Avers.Types | |
| FromDatum SessionId # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser SessionId # | |
| Pk SessionId # | |
Defined in Avers.Types | |
| type Rep SessionId # | |
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 # | |
| ToJSON Session # | |
Defined in Avers.Types | |
| FromJSON Session # | |
| ToDatum Session # | |
Defined in Avers.Types | |
| FromDatum Session # | |
Defined in Avers.Types Methods parseDatum :: Datum -> Parser Session # | |
| Pk Session # | |
Defined in Avers.Types | |
| type Rep Session # | |
Defined in Avers.Types type Rep Session = D1 (MetaData "Session" "Avers.Types" "avers-0.0.17.1-9UlRn0838nX4asVZe4Ejxo" 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 #
Constructors
| InternalError !AversError | |
| DatabaseError !Text | |
| PatchError !PatchError | |
| ParseError !Value !Text | |
| UnknownObjectType !Text | |
| ObjectNotFound !ObjId | |
| DocumentNotFound !Text | |
| AversError !Text | |
| NotAuthorized |
Instances
internalError :: AversError -> Avers a #
databaseError :: Text -> Avers a #
patchError :: PatchError -> Avers a #
parseError :: MonadError AversError m => Value -> Text -> m a #
documentNotFound :: Text -> Avers a #
data ObjectType a #
An ObjectType describes a particular type of object that is managed by
Avers.
data SomeObjectType where #
Constructors
| SomeObjectType :: (ToDatum a, FromDatum a, FromJSON a, ToJSON a) => ObjectType a -> SomeObjectType |
parseValueAs :: FromJSON a => ObjectType a -> Value -> Either AversError a #
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 # | |
| Functor Avers # | |
| Applicative Avers # | |
| MonadIO Avers # | |
Defined in Avers.Types | |
| MonadAvers Avers # | |
Defined in Avers.Types | |
| MonadState Handle Avers # | |
| MonadError AversError Avers # | |
Defined in Avers.Types Methods throwError :: AversError -> Avers a # catchError :: Avers a -> (AversError -> Avers a) -> Avers a # | |
class Monad m => MonadAvers m where #
Instances
| MonadAvers Avers # | |
Defined in Avers.Types | |
| MonadAvers m => MonadAvers (StateT s m) # | |
Defined in Avers.Types | |
Constructors
| View | |
Fields
| |