Safe Haskell | None |
---|
Snap.Snaplet.Redson.Snapless.Metamodel
Description
Model definition parser, served model routines.
- type ModelName = ByteString
- type FieldName = ByteString
- type FieldValue = ByteString
- type FieldIndex = (FieldName, Bool)
- type Commit = Map FieldName FieldValue
- data Permissions
- = Roles [ByteString]
- | Everyone
- | Nobody
- data FieldTargets
- = Fields [FieldName]
- | AllFields
- | NoneFields
- type FieldMeta = Map FieldName Value
- data Field = Field {}
- canWrite :: Lens Field Permissions
- canRead :: Lens Field Permissions
- data Application = Application {}
- apWrite :: Lens Application (Maybe Permissions)
- apRead :: Lens Application (Maybe Permissions)
- data Model = Model {}
- canDeleteM :: Lens Model Permissions
- canUpdateM :: Lens Model Permissions
- canReadM :: Lens Model Permissions
- canCreateM :: Lens Model Permissions
- defaultFieldType :: ByteString
- type Groups = Map ByteString [Field]
- groupFieldName :: FieldName -> FieldName -> FieldName
- spliceGroups :: Groups -> Model -> Model
- doApplications :: Model -> Model
- cacheIndices :: Model -> Model
Documentation
type ModelName = ByteStringSource
type FieldName = ByteStringSource
type FieldValue = ByteStringSource
type FieldIndex = (FieldName, Bool)Source
Name of indexed field and collation flag.
type Commit = Map FieldName FieldValueSource
List of field key-value pairs.
Suitable for using with hmset
.
data Permissions Source
Field permissions property.
Constructors
Roles [ByteString] | |
Everyone | |
Nobody |
Instances
type FieldMeta = Map FieldName ValueSource
Map of field annotations which are transparently handled by server without any logic.
Form field object.
Constructors
Field | |
Fields
|
data Application Source
A list of properties to be applied to named fields.
Constructors
Application | |
Fields
|
Instances
Model describes fields and permissions.
Models are built from JSON definitions (using FromJSON instance for
Model) with further group splicing (spliceGroups
), applications
(doApplications
) and index caching (cacheIndices
).
Constructors
Model | |
Fields
|
defaultFieldType :: ByteStringSource
Used when field type is not specified in model description.
type Groups = Map ByteString [Field]Source
A named group of fields.
Arguments
:: FieldName | Name of field which is spliced into group |
-> FieldName | Name of group field |
-> FieldName |
Build new name f_gK
for every field of group g
to which field
f
is spliced into.
spliceGroups :: Groups -> Model -> ModelSource
Replace all model fields having groupName
annotation with
actual group fields.
doApplications :: Model -> ModelSource
Perform all applications in model.
cacheIndices :: Model -> ModelSource
Set indices field of model to list of FieldIndex
es