packages feed

keiro-dsl-0.2.0.0: test/conformance-process-full/Generated/SurgeDemo/Surge/Projection.hs

{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE OverloadedStrings #-}

-- @generated by keiro-dsl; do not edit. Regenerated from the .keiro spec.
module Generated.SurgeDemo.Surge.Projection (
    surgeProjection,
    surgeStatusFor,
) where

import Data.Text (Text)
import Generated.SurgeDemo.Surge.Domain
import Keiro.Projection (InlineProjection (..))
import SurgeDemo.Surge.Holes (applySurge)

-- The deterministic event->status mapping (hole-kind 3, /mapping/), derived
-- from the spec's status-map. The read-model SQL that consumes it lives in
-- the hand-owned Holes module (a DB-coupled hole, delegated to codd).
-- WARNING: no readmodel node declares 'surge'; unqualified SQL depends on search_path.
surgeStatusFor :: SurgeEvent -> Maybe Text
surgeStatusFor = \case
    SurgeThresholdNoted{} -> Just "noted"
    SurgeTimerFired{} -> Just "fired"

surgeProjection :: InlineProjection SurgeEvent
surgeProjection =
    InlineProjection
        { name = "surge-demo-surge-inline"
        , apply = applySurge
        }