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

Safe HaskellNone
LanguageHaskell2010

Exigo.Persistent.TH.Internal

Description

Unstable, may change without warning.

Utility funcs to support Exigo.Persistent.TH.

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.

accessorName :: MkPersistSettings -> Text -> String Source #

given some field from an entty def -- e.g. "q1a" -- get the actual accessor name (i.e. "marksQ1a")

isMarks :: EntityDef -> Bool Source #

is this the Marks entity?

fName :: FieldDef -> Text Source #

recNameNoUnderscore :: MkPersistSettings -> HaskellName -> HaskellName -> Text Source #

recName :: MkPersistSettings -> HaskellName -> HaskellName -> Text Source #

name for a record field

If we call recName datatypeName fieldName this returns a 'qualified field name' (i.e. data type name is prepended, and the whole thing is camelCased.

i.e. recName MyType "myfield" == "myTypeMyField" (modulo name constructors).