Documentation ¶
Overview ¶
Package pgfifo implements a barebones Pub/Sub message Queue backed by a Postgres database.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = 1
Database version
Functions ¶
This section is empty.
Types ¶
type Message ¶
A Message represents a single item in the Queue. The Payload of the message is encoded as JSON
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue object
func New ¶
func New(connectionStr string, options ...QueueOption) (*Queue, error)
New creates and returns a new Queue in the specified database. The provided connection string should conform to a connection string acceptable to github.com/lib/pq.
Available options that can be passed in when creating a Queue:
- TablePrefix (string) -- namespace to prefix on pgfifo tables. Defaults to "pgfifo"
- SubscriptionBatchSize (uint) -- batch size for subscriptions. Defaults to 10
A new Queue is returned if successful, and an error is returned if creating a new queue failed for some reason.
type QueueOption ¶ added in v0.2.0
QueueOption represents a configurable option that can be set for a Queue
func StringOption ¶ added in v0.2.0
func StringOption(name, value string) QueueOption
StringOption creates a new QueueOption containing a string
func UintOption ¶ added in v0.2.0
func UintOption(name string, value uint) QueueOption
UintOption creates a new QueueOption containing a uint
type SubscriptionCallback ¶
SubscriptionCallback is a client-provided callback. When new events are ready to be consumed, they are passed to this function. If an error is returned by this callback, all events are reprocessed.