snaplet-redson-0.1.0.0: CRUD for JSON data with Redis storage

Safe HaskellNone

Snap.Snaplet.Redson.Snapless.Metamodel

Description

Model definition parser, served model routines.

Synopsis

Documentation

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 

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.

groupFieldNameSource

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 FieldIndexes