CurryInfo: spicey-4.2.0 / Spicey.ControllerGeneration.deleteTransaction

definition: Info
 
deleteTransaction :: ControllerGenerator
deleteTransaction erdname (Entity entityName attrs) _ allEntities =
  let manyToManyEntities = manyToMany allEntities (Entity entityName attrs)
      entlc  = lowerFirst entityName  -- entity name in lowercase
      entvar = (0, entlc)             -- entity parameter for trans.
  in
   stCmtFunc
    ("Transaction to delete a given " ++ entityName ++ " entity.")
    (transFunctionName entityName "delete")
    1 Private
    (baseType (model erdname, entityName)
      ~> applyTC (dbconn "DBAction") [unitType])
    [simpleRule 
      [CPVar entvar] -- entity parameter for controller
      (doExpr $
         concatMap (\ (ename,erel) ->
           [CSPat (CPVar(0, "old" ++ erel ++ ename ++ "s"))
                  (applyF (controllerModuleName entityName,
                           "get" ++ erel ++ entityName ++ ename ++ "s")
                          [CVar entvar]),
            CSExpr (applyF (controllerModuleName entityName, "remove" ++ erel)
                           [cvar ("old" ++ erel ++ ename ++ "s"),
                            CVar entvar ])]
           )
           manyToManyEntities ++
         [CSExpr $ applyF (model erdname, "delete" ++ entityName)
                          [CVar entvar]])]
demand: Info
 argument 2
deterministic: Info
 deterministic operation
documentation: Info
 
Generates a transaction to delete an entity.
failfree: Info
 <FAILING>
indeterministic: Info
 referentially transparent operation
infix: Info
 no fixity defined
iotype: Info
 {(_,{Entity},_,_) |-> _}
name: Info
 deleteTransaction
precedence: Info
 no precedence defined
result-values: Info
 _
signature: Info
 String -> Database.ERD.Entity -> [Database.ERD.Relationship]
-> [Database.ERD.Entity] -> AbstractCurry.Types.CFuncDecl
solution-complete: Info
 operation might suspend on free variables
terminating: Info
 possibly non-terminating
totally-defined: Info
 possibly non-reducible on same data term