IHP Api Reference
Safe HaskellSafe-Inferred

IHP.DataSync.ChangeNotifications

Synopsis

Documentation

channelName :: TableWithRLS -> ByteString Source #

Returns the event name of the event that the pg notify trigger dispatches

data Change Source #

Constructors

Change 

Fields

Instances

Instances details
FromJSON Change Source # 
Instance details

Defined in IHP.DataSync.ChangeNotifications

Methods

parseJSON :: Value -> Parser Change #

parseJSONList :: Value -> Parser [Change] #

ToJSON Change Source # 
Instance details

Defined in IHP.DataSync.ChangeNotifications

Show Change Source # 
Instance details

Defined in IHP.DataSync.ChangeNotifications

Methods

showsPrec :: Int -> Change -> ShowS #

show :: Change -> String

showList :: [Change] -> ShowS #

Eq Change Source # 
Instance details

Defined in IHP.DataSync.ChangeNotifications

Methods

(==) :: Change -> Change -> Bool #

(/=) :: Change -> Change -> Bool #

data ChangeSet Source #

Constructors

InlineChangeSet 

Fields

ExternalChangeSet

When the patch fits into the 8000 bytes limit of pg_notify

Instances

Instances details
FromJSON ChangeSet Source # 
Instance details

Defined in IHP.DataSync.ChangeNotifications

Methods

parseJSON :: Value -> Parser ChangeSet #

parseJSONList :: Value -> Parser [ChangeSet] #

ToJSON ChangeSet Source # 
Instance details

Defined in IHP.DataSync.ChangeNotifications

Show ChangeSet Source # 
Instance details

Defined in IHP.DataSync.ChangeNotifications

Methods

showsPrec :: Int -> ChangeSet -> ShowS #

show :: ChangeSet -> String

showList :: [ChangeSet] -> ShowS #

Eq ChangeSet Source #

The patch is over 8000 bytes, so we have stored it in the large_pg_notifications table

Instance details

Defined in IHP.DataSync.ChangeNotifications

createNotificationFunction :: TableWithRLS -> Query Source #

Returns the sql code to set up a database trigger. Mainly used by watchInsertOrUpdateTable.

retrieveChanges :: (?modelContext :: ModelContext) => ChangeSet -> IO [Change] Source #

The pg_notify function has a payload limit of 8000 bytes. When a record update is larger than the payload size we store the patch in the large_pg_notifications table and pass over the id to the patch.

This function retrieves the patch from the large_pg_notifications table, or directly returns the patch when it's less than 8000 bytes.