Copyright | (c) Soostone Inc 2020 |
---|---|
License | AllRightsReserved |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- type Success = Bool
- checkUpdateStrategy :: MonadIO m => UTCTime -> Maybe SpecRun -> m Bool -> DepChain -> UpdateStrategy -> m Bool
- newtype SpecOpts = SpecOpts {}
- type SpecBackend bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 = (Command CreateViewAs t3 bk, Command CheckTableExists Bool bk, Command Grant t1 bk, Command (CreateTableAs (BackendTableMeta bk)) t4 bk, Command InsertIntoQuery t6 bk, Command drop t5 bk, Command DropView t2 bk, Command DropTable t5 bk, Command CopyTable t9 bk, Command DeleteFrom t8 bk, Command RenameTable t7 bk, Command GetRelationSchema (Fields Field) bk, Drop (CreateTableAs (BackendTableMeta bk)) drop, RenderSql (CreateTableAs (BackendTableMeta bk)) bk, RenderSql CreateViewAs bk, RenderSql (Ref Table) bk, RenderSql Query bk, RenderSql SExp bk, ReplaceReference bk, ParseSQL bk, Backend bk, MustacheBackend bk, Typeable bk, IsBackendTableMeta bk, RunBackendEffect bk)
- newtype HookAssertionError = HookAssertionError (NonEmpty AssertionEntry)
- executeSpec :: forall m bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9. (MonadFix m, MonadBaseControl IO m, MonadMask m, Katip m, MonadReader ComboEnv m, SpecBackend bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9, MonadQueryStats m, RunBackendEffect bk) => RuntimeEnv -> bk -> MetadataBeamConnection -> SpecRuntime bk -> SpecOpts -> InterpretedSpec bk -> m Success
- dryRun :: (MonadIO m, Katip m) => AppName -> Pipeline -> Ref Table -> DepChain -> b -> t -> m (Either a b, SpecRun)
- reportFatalError :: Maybe RuntimeEventQueue -> IO ()
- reportTableFailed :: Maybe RuntimeEventQueue -> Ref Table -> String -> IO ()
- reportProgress :: Show a => Maybe RuntimeEventQueue -> Ref Table -> ComboT IO (Either a b, SpecRun) -> ComboT IO (Either a b, SpecRun)
- reportCompletion :: MonadIO m => Maybe RuntimeEventQueue -> TrackingQueryStats -> m ()
- reportSkipUpdate :: MonadIO m => Maybe RuntimeEventQueue -> Ref Table -> m ()
- newtype HaskellEvaluationError = HaskellEvaluationError InterpreterError
- data ValidationError
- = CycleDetectedError [[Ref Table]]
- | ExtraneousDependenciesError (Ref Table) [Ref Table]
- | CustomPreprocessorError Text
- | YamlError Text
- | SpecMetaArgError Text
- | HaskellInterpreterError HaskellEvaluationError
- | ValidationError_NapkinEffectError (Ref Table) NapkinEffectError
- | ValidationError_ProgramValidationError Text
- class Exception a => ShowExceptionWithPrefix a where
- type ValidateAndPreprocess bk = (ParseSQL bk, ReifiesBackend bk, MustacheBackend bk, IsBackendTableMeta bk, RunBackendEffect bk)
- validateAndPreprocessSpecs :: forall m bk. (MonadIO m, ValidateAndPreprocess bk) => RuntimeEnv -> InterpretedSpec bk -> m (Either [ValidationError] (Specs bk))
- runHook :: forall backend t1 tr t8 t7 t4 t3 t5 t6. (Backend backend, Command (CreateTableAs (BackendTableMeta backend)) t1 backend, Command InsertIntoQuery tr backend, Command DeleteFrom t8 backend, Command DropView t7 backend, Command DropTable t6 backend, Command CopyTable t5 backend, Command RenameTable t4 backend, Command CreateViewAs t3 backend, Command CheckTableExists Bool backend, Command GetRelationSchema (Fields Field) backend, ParseSQL backend, MustacheBackend backend, IsBackendTableMeta backend, RunBackendEffect backend, RenderSql (Alias Relation) backend, RenderSql (Alias SExp) backend) => RuntimeEnv -> ExternMacros -> BackendConn backend -> SpecMetaArgs -> [Text] -> HookProgram backend -> ComboT IO (Either (NonEmpty AssertionEntry) [AssertionEntry])
- prettyQueryStatsForTable :: Ref Table -> TrackingQueryStats -> String
- logAssertions :: (Katip m, Traversable l) => l AssertionEntry -> m ()
- logFinalReport :: (Katip m, RenderSql (Ref Table) bk, MonadQueryStats m) => bk -> [(Ref Table, Either SomeException (Either b ([AssertionEntry], SpecRun), TrackingQueryStats))] -> [Either SomeException (Maybe (Either (NonEmpty AssertionEntry) [AssertionEntry]), TrackingQueryStats)] -> m ()
- srDuration :: SpecRun -> NominalDiffTime
Documentation
checkUpdateStrategy :: MonadIO m => UTCTime -> Maybe SpecRun -> m Bool -> DepChain -> UpdateStrategy -> m Bool #
Should I be running the update?
type SpecBackend bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9 = (Command CreateViewAs t3 bk, Command CheckTableExists Bool bk, Command Grant t1 bk, Command (CreateTableAs (BackendTableMeta bk)) t4 bk, Command InsertIntoQuery t6 bk, Command drop t5 bk, Command DropView t2 bk, Command DropTable t5 bk, Command CopyTable t9 bk, Command DeleteFrom t8 bk, Command RenameTable t7 bk, Command GetRelationSchema (Fields Field) bk, Drop (CreateTableAs (BackendTableMeta bk)) drop, RenderSql (CreateTableAs (BackendTableMeta bk)) bk, RenderSql CreateViewAs bk, RenderSql (Ref Table) bk, RenderSql Query bk, RenderSql SExp bk, ReplaceReference bk, ParseSQL bk, Backend bk, MustacheBackend bk, Typeable bk, IsBackendTableMeta bk, RunBackendEffect bk) #
What we seem to need to be able to call executeSpec
; it's
basically all about choosing a backend that satisfies the
needed operations.
newtype HookAssertionError #
Instances
Show HookAssertionError # | |
Defined in Napkin.Run.Execute showsPrec :: Int -> HookAssertionError -> ShowS # show :: HookAssertionError -> String # showList :: [HookAssertionError] -> ShowS # | |
Exception HookAssertionError # | |
Defined in Napkin.Run.Execute |
executeSpec :: forall m bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9. (MonadFix m, MonadBaseControl IO m, MonadMask m, Katip m, MonadReader ComboEnv m, SpecBackend bk drop t1 t2 t3 t4 t5 t6 t7 t8 t9, MonadQueryStats m, RunBackendEffect bk) => RuntimeEnv -> bk -> MetadataBeamConnection -> SpecRuntime bk -> SpecOpts -> InterpretedSpec bk -> m Success #
dryRun :: (MonadIO m, Katip m) => AppName -> Pipeline -> Ref Table -> DepChain -> b -> t -> m (Either a b, SpecRun) #
A run that succeeds immediately without ever actually running anything.
reportFatalError :: Maybe RuntimeEventQueue -> IO () #
reportTableFailed :: Maybe RuntimeEventQueue -> Ref Table -> String -> IO () #
reportProgress :: Show a => Maybe RuntimeEventQueue -> Ref Table -> ComboT IO (Either a b, SpecRun) -> ComboT IO (Either a b, SpecRun) #
Report runtime updates as the Spec execution progresses.
reportCompletion :: MonadIO m => Maybe RuntimeEventQueue -> TrackingQueryStats -> m () #
reportSkipUpdate :: MonadIO m => Maybe RuntimeEventQueue -> Ref Table -> m () #
newtype HaskellEvaluationError #
Instances
Eq HaskellEvaluationError # | |
Defined in Napkin.Run.Execute | |
Show HaskellEvaluationError # | |
Defined in Napkin.Run.Execute showsPrec :: Int -> HaskellEvaluationError -> ShowS # show :: HaskellEvaluationError -> String # showList :: [HaskellEvaluationError] -> ShowS # |
data ValidationError #
Instances
Eq ValidationError # | |
Defined in Napkin.Run.Execute (==) :: ValidationError -> ValidationError -> Bool # (/=) :: ValidationError -> ValidationError -> Bool # | |
Show ValidationError # | |
Defined in Napkin.Run.Execute showsPrec :: Int -> ValidationError -> ShowS # show :: ValidationError -> String # showList :: [ValidationError] -> ShowS # | |
Exception ValidationError # | |
Defined in Napkin.Run.Execute | |
ShowExceptionWithPrefix ValidationError # | |
Defined in Napkin.Run.Execute showParts :: ValidationError -> (Text, Text) # |
class Exception a => ShowExceptionWithPrefix a where #
Instances
ShowExceptionWithPrefix ValidationError # | |
Defined in Napkin.Run.Execute showParts :: ValidationError -> (Text, Text) # |
type ValidateAndPreprocess bk = (ParseSQL bk, ReifiesBackend bk, MustacheBackend bk, IsBackendTableMeta bk, RunBackendEffect bk) #
validateAndPreprocessSpecs :: forall m bk. (MonadIO m, ValidateAndPreprocess bk) => RuntimeEnv -> InterpretedSpec bk -> m (Either [ValidationError] (Specs bk)) #
Run basic checks against all Specs and convert every raw query to normal Query.
runHook :: forall backend t1 tr t8 t7 t4 t3 t5 t6. (Backend backend, Command (CreateTableAs (BackendTableMeta backend)) t1 backend, Command InsertIntoQuery tr backend, Command DeleteFrom t8 backend, Command DropView t7 backend, Command DropTable t6 backend, Command CopyTable t5 backend, Command RenameTable t4 backend, Command CreateViewAs t3 backend, Command CheckTableExists Bool backend, Command GetRelationSchema (Fields Field) backend, ParseSQL backend, MustacheBackend backend, IsBackendTableMeta backend, RunBackendEffect backend, RenderSql (Alias Relation) backend, RenderSql (Alias SExp) backend) => RuntimeEnv -> ExternMacros -> BackendConn backend -> SpecMetaArgs -> [Text] -> HookProgram backend -> ComboT IO (Either (NonEmpty AssertionEntry) [AssertionEntry]) #
logAssertions :: (Katip m, Traversable l) => l AssertionEntry -> m () #
logFinalReport :: (Katip m, RenderSql (Ref Table) bk, MonadQueryStats m) => bk -> [(Ref Table, Either SomeException (Either b ([AssertionEntry], SpecRun), TrackingQueryStats))] -> [Either SomeException (Maybe (Either (NonEmpty AssertionEntry) [AssertionEntry]), TrackingQueryStats)] -> m () #
srDuration :: SpecRun -> NominalDiffTime #