exigo-schema-0.2.0.2: database schema for exigo marking/assessment tools

Safe HaskellNone
LanguageHaskell2010

Exigo.Persistent.TH

Description

Template Haskell functions that allow all questions and comments for an assessment to be easily accessed.

It's assumed assessments will have their own add-on database schemas, and will define an entity Marks itemizing what marks can be awarded and what comments an assessor might make.

Synopsis

Documentation

mkSaveAssessmentMetadata :: String -> AssessmentMetadata -> Q [Dec] Source #

create a function which returns at runtime the assessment metadata passed in at compile-time.

i.e., if mkSaveAssessmentMetadata myFunc mData is called, it creates a function like

myFunc :: AssessmentMetadata
myFunc = mData

mkQuestionFieldsAccessor :: MkPersistSettings -> String -> [EntityDef] -> Q [Dec] Source #

create a function which returns all the question-type field accessors for Marks.

i.e., mkQuestionFieldsAccessor sqlSettings myName in a call to share should produce a result something like

myNHame :: [Marks -> Double]
myName = [ marksQ1a, marksQ1b, marksQ1c .. ]

where the accessors are in the order they appear in the EntityDef.

mkCommentFieldsAccessor :: MkPersistSettings -> String -> [EntityDef] -> Q [Dec] Source #

create a function which returns all the comment-type field accessors for Marks.

i.e., mkCommentFieldsAccessor myName

should produce a result something like

myNHame :: [Marks -> Maybe Text]
myName = [ marksQ1aComments, marksQ1bComments, marksQ1cComments .. ]

where the accessors are in the order they appear in the EntityDef.