napkin-0.5.13
Copyright(c) Soostone Inc 2020
LicenseAllRightsReserved
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Napkin.Spec.Types.Spec

Description

 
Synopsis

Documentation

data TableSpec b #

Constructors

TableSpec 

Fields

Instances

Instances details
ToJSON (TableSpec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

ToObject (TableSpec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

toObject :: TableSpec b -> Object #

LogItem (TableSpec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

AsRelation (TableSpec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

TableRef (TableSpec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

tableRef :: Lens' (TableSpec b) (Ref Table) #

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.

Instances

Instances details
Eq UpdateStrategy # 
Instance details

Defined in Napkin.Spec.Types.Spec

Data UpdateStrategy # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UpdateStrategy -> c UpdateStrategy #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c UpdateStrategy #

toConstr :: UpdateStrategy -> Constr #

dataTypeOf :: UpdateStrategy -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c UpdateStrategy) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c UpdateStrategy) #

gmapT :: (forall b. Data b => b -> b) -> UpdateStrategy -> UpdateStrategy #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UpdateStrategy -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UpdateStrategy -> r #

gmapQ :: (forall d. Data d => d -> u) -> UpdateStrategy -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UpdateStrategy -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UpdateStrategy -> m UpdateStrategy #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UpdateStrategy -> m UpdateStrategy #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UpdateStrategy -> m UpdateStrategy #

Ord UpdateStrategy # 
Instance details

Defined in Napkin.Spec.Types.Spec

Show UpdateStrategy # 
Instance details

Defined in Napkin.Spec.Types.Spec

Generic UpdateStrategy # 
Instance details

Defined in Napkin.Spec.Types.Spec

Associated Types

type Rep UpdateStrategy :: Type -> Type #

ToJSON UpdateStrategy # 
Instance details

Defined in Napkin.Spec.Yaml.Types

FromJSON UpdateStrategy # 
Instance details

Defined in Napkin.Spec.Yaml.Types

type Rep UpdateStrategy # 
Instance details

Defined in Napkin.Spec.Types.Spec

type Rep UpdateStrategy = D1 ('MetaData "UpdateStrategy" "Napkin.Spec.Types.Spec" "napkin-0.5.13-8705pBGlgyp7AIaYGNE2fM" 'False) ((C1 ('MetaCons "UpdateAlways" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UpdatePeriodically" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 NominalDiffTime))) :+: (C1 ('MetaCons "UpdateWithDependency" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "UpdateIfMissing" 'PrefixI 'False) (U1 :: Type -> Type)))

data Specs b #

Constructors

Specs 

Fields

Instances

Instances details
Generic (Specs b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Associated Types

type Rep (Specs b) :: Type -> Type #

Methods

from :: Specs b -> Rep (Specs b) x #

to :: Rep (Specs b) x -> Specs b #

Default (Specs b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

def :: Specs b #

MonadState (Specs b) (Spec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

get :: Spec b (Specs b) #

put :: Specs b -> Spec b () #

state :: (Specs b -> (a, Specs b)) -> Spec b a #

type Rep (Specs b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

type Rep (Specs b) = D1 ('MetaData "Specs" "Napkin.Spec.Types.Spec" "napkin-0.5.13-8705pBGlgyp7AIaYGNE2fM" 'False) (C1 ('MetaCons "Specs" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_specsTables") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (SpecTableMap b)) :*: S1 ('MetaSel ('Just "_specsHooks") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [([Ref Table], HookProgram b)])) :*: (S1 ('MetaSel ('Just "_specsMetaArgs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SpecMetaArgs) :*: S1 ('MetaSel ('Just "_specsTransformer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 QueryTransformer))))

newtype Spec b a #

Constructors

Spec 

Fields

Instances

Instances details
Monad (Spec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

(>>=) :: Spec b a -> (a -> Spec b b0) -> Spec b b0 #

(>>) :: Spec b a -> Spec b b0 -> Spec b b0 #

return :: a -> Spec b a #

Functor (Spec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

fmap :: (a -> b0) -> Spec b a -> Spec b b0 #

(<$) :: a -> Spec b b0 -> Spec b a #

Applicative (Spec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

pure :: a -> Spec b a #

(<*>) :: Spec b (a -> b0) -> Spec b a -> Spec b b0 #

liftA2 :: (a -> b0 -> c) -> Spec b a -> Spec b b0 -> Spec b c #

(*>) :: Spec b a -> Spec b b0 -> Spec b b0 #

(<*) :: Spec b a -> Spec b b0 -> Spec b a #

MonadIO (Spec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

liftIO :: IO a -> Spec b a #

MonadThrow (Spec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

throwM :: Exception e => e -> Spec b a #

MonadCatch (Spec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

catch :: Exception e => Spec b a -> (e -> Spec b a) -> Spec b a #

MonadMask (Spec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

mask :: ((forall a. Spec b a -> Spec b a) -> Spec b b0) -> Spec b b0 #

uninterruptibleMask :: ((forall a. Spec b a -> Spec b a) -> Spec b b0) -> Spec b b0 #

generalBracket :: Spec b a -> (a -> ExitCase b0 -> Spec b c) -> (a -> Spec b b0) -> Spec b (b0, c) #

MonadState (Specs b) (Spec b) # 
Instance details

Defined in Napkin.Spec.Types.Spec

Methods

get :: Spec b (Specs b) #

put :: Specs b -> Spec b () #

state :: (Specs b -> (a, Specs b)) -> Spec b a #

newtype CustomValidator #

CustomValidators 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.

Instances

Instances details
Default CustomValidator # 
Instance details

Defined in Napkin.Spec.Types.Spec

pattern NapkinTablePrefix :: (Eq a, IsString a) => a #

runSpec :: Spec b a -> IO (Specs b) #

runSpecE :: ExceptT e (Spec b) a -> IO (Either e (Specs b)) #

specTable :: forall b. Lens' (TableSpec b) (Ref Table) #

specGrants :: forall b. Lens' (TableSpec b) [([Privilege], [Actor])] #

specAction :: forall b. Lens' (TableSpec b) (SpecProgram b) #

specsTables :: forall b. Lens' (Specs b) (SpecTableMap b) #

specsHooks :: forall b. Lens' (Specs b) [([Ref Table], HookProgram b)] #

allSpecsTables :: Specs b -> Set (Ref Table) #

All tables that are being created/managed as part of this spec.

setAllTableGrants :: MonadState (Specs b) m => [([Privilege], [Actor])] -> m () #

Set the same Grant permissions for all tables defined in the spec at once. Convenience function for a common use case. Acts monadically, so it will apply to all specs so far defined in the Spec block.