Safe Haskell | None |
---|
IHP.DataSync.ChangeNotifications
Synopsis
- channelName :: TableWithRLS -> ByteString
- data ChangeNotification
- data Change = Change {}
- data ChangeSet
- = InlineChangeSet { }
- | ExternalChangeSet { }
- createNotificationFunction :: TableWithRLS -> Query
- installTableChangeTriggers :: (?modelContext :: ModelContext) => TableWithRLS -> IO ()
- makeCachedInstallTableChangeTriggers :: (?modelContext :: ModelContext) => IO (TableWithRLS -> IO ())
- retrieveChanges :: (?modelContext :: ModelContext) => ChangeSet -> IO [Change]
Documentation
channelName :: TableWithRLS -> ByteString Source #
Returns the event name of the event that the pg notify trigger dispatches
data ChangeNotification Source #
Constructors
DidInsert | |
DidUpdate | |
DidUpdateLarge | |
DidDelete | |
Instances
FromJSON ChangeNotification Source # | |
Defined in IHP.DataSync.ChangeNotifications Methods parseJSON :: Value -> Parser ChangeNotification # parseJSONList :: Value -> Parser [ChangeNotification] # | |
ToJSON ChangeNotification Source # | |
Defined in IHP.DataSync.ChangeNotifications Methods toJSON :: ChangeNotification -> Value # toEncoding :: ChangeNotification -> Encoding # toJSONList :: [ChangeNotification] -> Value # toEncodingList :: [ChangeNotification] -> Encoding # omitField :: ChangeNotification -> Bool # | |
Show ChangeNotification Source # | |
Defined in IHP.DataSync.ChangeNotifications Methods showsPrec :: Int -> ChangeNotification -> ShowS # show :: ChangeNotification -> String showList :: [ChangeNotification] -> ShowS # | |
Eq ChangeNotification Source # | |
Defined in IHP.DataSync.ChangeNotifications Methods (==) :: ChangeNotification -> ChangeNotification -> Bool # (/=) :: ChangeNotification -> ChangeNotification -> Bool # |
Constructors
InlineChangeSet | |
ExternalChangeSet | When the patch fits into the 8000 bytes limit of |
Fields |
createNotificationFunction :: TableWithRLS -> Query Source #
Returns the sql code to set up a database trigger. Mainly used by watchInsertOrUpdateTable
.
installTableChangeTriggers :: (?modelContext :: ModelContext) => TableWithRLS -> IO () Source #
makeCachedInstallTableChangeTriggers :: (?modelContext :: ModelContext) => IO (TableWithRLS -> IO ()) Source #
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.