| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Avers.Types
- 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.
Minimal complete definition
Path
This path refers to the root of an object. It is only used in Set
operations.
ObjId
The root object id is used for object created internally or when there is no applicable creator.
RevId
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. |
objectIdBase :: ObjectId -> ObjId Source #
The operations that can be applied to JSON values.
type PatchM a = Either PatchError a Source #
Constructors
| Object | |
Fields
| |
Patch
Constructors
| Patch | |
Fields
| |
Snapshot
Constructors
| Snapshot | |
Fields
| |
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
| |
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
| |
BlobId
Blob
SessionId
Constructors
| SessionId | |
Fields
| |
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
| |
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
class Monad m => MonadAvers m where Source #
Minimal complete definition
Instances
| MonadAvers Avers Source # | |
| MonadAvers m => MonadAvers (StateT s m) Source # | |
Constructors
| View | |
Fields
| |