Copyright | (c) Soostone Inc 2020 |
---|---|
License | AllRightsReserved |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | GHC2021 |
Synopsis
- data SpecTarget b
- data TableSpec b = TableSpec {
- _specTable :: SpecTableName
- _specAction :: SpecProgram b
- _specPreHooks :: [HookProgram b]
- _specPostHooks :: [HookProgram b]
- _specUpdate :: [UpdateStrategy]
- _specGrants :: [([Privilege], [Actor])]
- _specTags :: Set TableSpecTag
- type TableSpecTag = Text
- data UpdateStrategy
- type SpecTableMap b = Map SpecTableName (TableSpec b)
- data Specs b = Specs {}
- newtype Spec b a = Spec {}
- newtype CustomValidator = CustomValidator {
- unCustomValidator :: SpecMetaArgs -> Ref Table -> Maybe FilePath -> Query -> [Text]
- newtype ExternMacros = ExternMacros (Map (Ref Function) (ExternFun -> SExp))
- newtype SpecPreprocessorWithArgParser b = SpecPreprocessorWithArgParser (Object -> Parser (SpecProgramArguments, SpecPreprocessor b))
- parserlessPreprocessor :: SpecPreprocessor b -> SpecPreprocessorWithArgParser b
- data SpecDependency
- toRef :: SpecDependency -> Ref Table
- toSpecTable :: SpecDependency -> Maybe SpecTableName
- isManaged :: SpecDependency -> Bool
- type SpecsDeps = Map SpecTableName (Set SpecDependency)
- type DepsValidator = (SpecDependency -> Ref Table) -> SpecsDeps -> [Text]
- type SpecPreprocessor b = Sem [Input SpecPaths, Input MetaArguments, State (Specs b), Output DepsValidator, FatalError, Embed IO, Log] ()
- type SpecPreprocessorFunc bk = SpecMetaArgs -> Specs bk -> Specs bk
- runSpec :: SpecPaths -> Spec b a -> IO (Specs b)
- runSpecE :: SpecPaths -> ExceptT e (Spec b) a -> IO (Either e (Specs b))
- runSpecE' :: SpecPaths -> Specs b -> ExceptT e (Spec b) a -> IO (Either e (a, Specs b))
- specUpdate :: forall b. Lens' (TableSpec b) [UpdateStrategy]
- specTags :: forall b. Lens' (TableSpec b) (Set TableSpecTag)
- specTable :: forall b. Lens' (TableSpec b) SpecTableName
- specPreHooks :: forall b. Lens' (TableSpec b) [HookProgram b]
- specPostHooks :: forall b. Lens' (TableSpec b) [HookProgram b]
- specGrants :: forall b. Lens' (TableSpec b) [([Privilege], [Actor])]
- specAction :: forall b. Lens' (TableSpec b) (SpecProgram b)
- specsTransformer :: forall b. Lens' (Specs b) QueryTransformer
- specsTables :: forall b. Lens' (Specs b) (SpecTableMap b)
- specsMetaArgs :: forall b. Lens' (Specs b) SpecMetaArgs
- specsHooks :: forall b. Lens' (Specs b) [(Text, [SpecTableName], GlobalHookProgram b)]
- allSpecsTables :: Specs b -> Set SpecTableName
- defineTable :: TableSpec b -> Spec b ()
- specAddPreHooks :: [HookProgram b] -> TableSpec b -> TableSpec b
- specAddPostHooks :: [HookProgram b] -> TableSpec b -> TableSpec b
Documentation
data SpecTarget b #
TableSpec | |
|
Instances
ToJSON (TableSpec b) # | |
Defined in Napkin.Spec.Types.Spec | |
LogItem (TableSpec b) # | |
Defined in Napkin.Spec.Types.Spec payloadKeys :: Verbosity -> TableSpec b -> PayloadSelection # | |
ToObject (TableSpec b) # | |
Defined in Napkin.Spec.Types.Spec |
type TableSpecTag = Text #
data UpdateStrategy #
Each strategy acts independently. For example, if you have only UpdateWithDependency, it wouldn't update even if the table were missing. You need to specify each strategy in the list.
UpdateAlways | |
UpdatePeriodically NominalDiffTime | |
UpdateWithDependency | |
UpdateIfMissing | |
UpdateIfErroredLastRun |
Instances
type SpecTableMap b = Map SpecTableName (TableSpec b) #
Specs | |
|
Instances
Generic (Specs b) # | |
Default (Specs b) # | |
Defined in Napkin.Spec.Types.Spec | |
MonadState (Specs b) (Spec b) # | |
type Rep (Specs b) # | |
Defined in Napkin.Spec.Types.Spec type Rep (Specs b) = D1 ('MetaData "Specs" "Napkin.Spec.Types.Spec" "napkin-0.5.14-JrXUGmKUOt9J0meJSj0Kh4" 'False) (C1 ('MetaCons "Specs" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_specsTables") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SpecTableMap b)) :*: S1 ('MetaSel ('Just "_specsHooks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [(Text, [SpecTableName], GlobalHookProgram b)])) :*: (S1 ('MetaSel ('Just "_specsMetaArgs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SpecMetaArgs) :*: S1 ('MetaSel ('Just "_specsTransformer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QueryTransformer)))) |
Instances
MonadReader SpecPaths (Spec b) # | |
MonadIO (Spec b) # | |
Defined in Napkin.Spec.Types.Spec | |
Applicative (Spec b) # | |
Functor (Spec b) # | |
Monad (Spec b) # | |
MonadCatch (Spec b) # | |
MonadMask (Spec b) # | |
MonadThrow (Spec b) # | |
Defined in Napkin.Spec.Types.Spec | |
MonadState (Specs b) (Spec b) # | |
newtype CustomValidator #
CustomValidator
s are run before namespacing and return a list of errors in the incoming Spec.
TODO. I find this outmoded - it's a very restrictive form of doing custom validations. The new effect machinery is much richer in being able to introspect different types of database interactions under the SqlBackend type. Keeping this for legacy compatibility for now.
CustomValidator | |
|
Instances
Default CustomValidator # | |
Defined in Napkin.Spec.Types.Spec def :: CustomValidator # |
newtype ExternMacros #
Instances
Monoid ExternMacros # | |
Defined in Napkin.Spec.Types.Spec mempty :: ExternMacros # mappend :: ExternMacros -> ExternMacros -> ExternMacros # mconcat :: [ExternMacros] -> ExternMacros # | |
Semigroup ExternMacros # | |
Defined in Napkin.Spec.Types.Spec (<>) :: ExternMacros -> ExternMacros -> ExternMacros # sconcat :: NonEmpty ExternMacros -> ExternMacros # stimes :: Integral b => b -> ExternMacros -> ExternMacros # | |
IsList ExternMacros # | |
Defined in Napkin.Spec.Types.Spec type Item ExternMacros # fromList :: [Item ExternMacros] -> ExternMacros # fromListN :: Int -> [Item ExternMacros] -> ExternMacros # toList :: ExternMacros -> [Item ExternMacros] # | |
Default ExternMacros # | |
Defined in Napkin.Spec.Types.Spec def :: ExternMacros # | |
type Item ExternMacros # | |
Defined in Napkin.Spec.Types.Spec |
newtype SpecPreprocessorWithArgParser b #
data SpecDependency #
Instances
Show SpecDependency # | |
Defined in Napkin.Spec.Types.Spec showsPrec :: Int -> SpecDependency -> ShowS # show :: SpecDependency -> String # showList :: [SpecDependency] -> ShowS # | |
Buildable SpecDependency # | |
Defined in Napkin.Spec.Types.Spec build :: SpecDependency -> Builder # | |
Eq SpecDependency # | |
Defined in Napkin.Spec.Types.Spec (==) :: SpecDependency -> SpecDependency -> Bool # (/=) :: SpecDependency -> SpecDependency -> Bool # | |
Ord SpecDependency # | |
Defined in Napkin.Spec.Types.Spec compare :: SpecDependency -> SpecDependency -> Ordering # (<) :: SpecDependency -> SpecDependency -> Bool # (<=) :: SpecDependency -> SpecDependency -> Bool # (>) :: SpecDependency -> SpecDependency -> Bool # (>=) :: SpecDependency -> SpecDependency -> Bool # max :: SpecDependency -> SpecDependency -> SpecDependency # min :: SpecDependency -> SpecDependency -> SpecDependency # |
toRef :: SpecDependency -> Ref Table #
isManaged :: SpecDependency -> Bool #
type SpecsDeps = Map SpecTableName (Set SpecDependency) #
type DepsValidator = (SpecDependency -> Ref Table) -> SpecsDeps -> [Text] #
type SpecPreprocessor b = Sem [Input SpecPaths, Input MetaArguments, State (Specs b), Output DepsValidator, FatalError, Embed IO, Log] () #
type SpecPreprocessorFunc bk = SpecMetaArgs -> Specs bk -> Specs bk #
specUpdate :: forall b. Lens' (TableSpec b) [UpdateStrategy] #
specTable :: forall b. Lens' (TableSpec b) SpecTableName #
specPreHooks :: forall b. Lens' (TableSpec b) [HookProgram b] #
specPostHooks :: forall b. Lens' (TableSpec b) [HookProgram b] #
specAction :: forall b. Lens' (TableSpec b) (SpecProgram b) #
specsTransformer :: forall b. Lens' (Specs b) QueryTransformer #
specsTables :: forall b. Lens' (Specs b) (SpecTableMap b) #
specsMetaArgs :: forall b. Lens' (Specs b) SpecMetaArgs #
specsHooks :: forall b. Lens' (Specs b) [(Text, [SpecTableName], GlobalHookProgram b)] #
allSpecsTables :: Specs b -> Set SpecTableName #
All tables that are being created/managed as part of this spec.
defineTable :: TableSpec b -> Spec b () #
specAddPreHooks :: [HookProgram b] -> TableSpec b -> TableSpec b #
specAddPostHooks :: [HookProgram b] -> TableSpec b -> TableSpec b #