Documentation
¶
Index ¶
Constants ¶
const ( // DefaultSchema is the database schema when it isn't set DefaultSchema = "broadcaster" // NotifyChannel is the channel the broadcaster listens on, by default, // which the modules notify of their changes on NotifyChannel = "events" )
const ( // EventName is the name of each server-sent event which is streamed to // a client watching events EventName = "event" // EventShutdown is the name of the server-sent event which is streamed // to a client watching events when the server stops, before the stream // ends, so the client knows it ended as there will be no more events EventShutdown = "shutdown" )
const ( // MaxPayloadSize is the largest event, as JSON, which can be published, // which is the largest notification Postgres sends, less a byte MaxPayloadSize = 7999 )
Variables ¶
var Queries string
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct {
Schema string `json:"schema,omitempty"`
Table string `json:"table,omitempty"`
Action string `json:"action,omitempty"`
Row string `json:"row,omitempty"`
}
Event is a change which is published to the broadcaster's channel: what changed, such as a table of a schema, how, such as INSERT, UPDATE or DELETE, as the database's triggers notify of their tables' changes, and which row, or rows, changed, when it says, such as by an identifier which the rows share
type EventFilter ¶
type EventFilter struct {
Schema string `json:"schema,omitempty" help:"returns only events of the schema"`
Table string `json:"table,omitempty" help:"returns only events of the table"`
Action string `json:"action,omitempty" help:"returns only events of the action, such as INSERT, UPDATE or DELETE"`
}
EventFilter matches events: those with its schema, table and action, each of which matches any when it's empty
func (EventFilter) Matches ¶
func (f EventFilter) Matches(event Event) bool
Matches returns true when the event has the filter's schema, table and action, each of which matches any when it's empty
func (EventFilter) Query ¶
func (f EventFilter) Query() url.Values
Query returns the filter as the query of a request to watch events