graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.Backends.Postgres.DDL.EventTrigger

Description

Postgres DDL EventTrigger

Used for creating event triggers for metadata changes.

See Cache and Backend.

Synopsis

Documentation

createMissingSQLTriggers :: (MonadIO m, MonadError QErr m, MonadBaseControl IO m, HasServerConfigCtx m, Backend ('Postgres pgKind)) => PGSourceConfig -> TableName ('Postgres pgKind) -> ([ColumnInfo ('Postgres pgKind)], Maybe (PrimaryKey ('Postgres pgKind) (ColumnInfo ('Postgres pgKind)))) -> TriggerName -> TriggerOpsDef ('Postgres pgKind) -> m () Source #

createTableEventTrigger :: (Backend ('Postgres pgKind), MonadIO m, MonadBaseControl IO m) => ServerConfigCtx -> PGSourceConfig -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> TriggerName -> TriggerOpsDef ('Postgres pgKind) -> Maybe (PrimaryKey ('Postgres pgKind) (ColumnInfo ('Postgres pgKind))) -> m (Either QErr ()) Source #

fetchEvents :: SourceName -> [TriggerName] -> FetchBatchSize -> TxE QErr [Event ('Postgres pgKind)] Source #

Lock and return events not yet being processed or completed, up to some limit. Process events approximately in created_at order, but we make no ordering guarentees; events can and will race. Nevertheless we want to ensure newer change events don't starve older ones.

unlockEventsTx :: [EventId] -> TxE QErr Int Source #

unlockEvents takes an array of EventId and unlocks them. This function is called when a graceful shutdown is initiated.

newtype QualifiedTriggerName Source #

QualifiedTriggerName is a type to store the name of the SQL trigger. An example of it is `"notify_hasura_users_all_INSERT"` where users_all is the name of the event trigger.

Constructors

QualifiedTriggerName 

Fields

mkTriggerFunctionQ :: forall pgKind m. (Backend ('Postgres pgKind), MonadTx m, MonadReader ServerConfigCtx m) => TriggerName -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> Ops -> SubscribeOpSpec ('Postgres pgKind) -> m QualifiedTriggerName Source #

pgIdenTrigger is a method used to construct the name of the pg function used for event triggers which are present in the hdb_catalog schema.

Define the pgSQL trigger functions on database events.

mkTrigger :: forall pgKind m. (Backend ('Postgres pgKind), MonadTx m, MonadReader ServerConfigCtx m) => TriggerName -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> Ops -> SubscribeOpSpec ('Postgres pgKind) -> m () Source #

mkAllTriggersQ :: forall pgKind m. (Backend ('Postgres pgKind), MonadTx m, MonadReader ServerConfigCtx m) => TriggerName -> QualifiedTable -> [ColumnInfo ('Postgres pgKind)] -> TriggerOpsDef ('Postgres pgKind) -> m () Source #