snaplet-redson- CRUD for JSON data with Redis storage

Safe HaskellNone



Model definition parser, served model routines.



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.


Roles [ByteString] 

type FieldMeta = Map FieldName ValueSource

Map of field annotations which are transparently handled by server without any logic.

data Application Source

A list of properties to be applied to named fields.

data Model Source

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).

defaultFieldType :: ByteStringSource

Used when field type is not specified in model description.

type Groups = Map ByteString [Field]Source

A named group of fields.



:: 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 FieldIndexes