pgnotifier

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WaitingState   = "waiting"
	ExecutingState = "executing"
	SucceededState = "succeeded"
	FailedState    = "failed"
	AbortedState   = "aborted"
)

Variables

This section is empty.

Functions

func CheckForPGNotifierEnvVars added in v0.1.10

func CheckForPGNotifierEnvVars() bool

CheckForPGNotifierEnvVars Checks if all the required Env Variables for PG Notifier are present

func GetCurrentSQLTimestamp

func GetCurrentSQLTimestamp() string

GetCurrentSQLTimestamp to get sql complaint current datetime string

func GetPGNotifierConnectionString added in v0.1.10

func GetPGNotifierConnectionString() string

GetPGNotifierConnectionString Returns PG Notifier DB Connection Configuration

func GetSQLTimestamp

func GetSQLTimestamp(t time.Time) string

GetSQLTimestamp to get sql complaint current datetime string from the given duration

Types

type ClaimResponseT

type ClaimResponseT struct {
	Payload json.RawMessage
	Err     error
}

type ClaimT

type ClaimT struct {
	ID                int64
	BatchID           string
	Status            string
	Payload           json.RawMessage
	ClaimResponseChan chan ClaimResponseT
}

type MessageT

type MessageT struct {
	Payload json.RawMessage
}

type NotificationT

type NotificationT struct {
	ID      int64
	BatchID string `json:"batch_id"`
	Status  string
}

type PgNotifierT

type PgNotifierT struct {
	URI string
	// contains filtered or unexported fields
}

func New

func New(workspaceIdentifier string, fallbackConnectionInfo string) (notifier PgNotifierT, err error)

New Given default connection info return pg notifiew object from it

func (PgNotifierT) AddTopic

func (notifier PgNotifierT) AddTopic(topic string) (err error)

func (*PgNotifierT) Claim

func (notifier *PgNotifierT) Claim(workerID string) (claim ClaimT, claimed bool)

func (PgNotifierT) GetDBHandle added in v0.1.10

func (notifier PgNotifierT) GetDBHandle() *sql.DB

func (*PgNotifierT) Publish

func (notifier *PgNotifierT) Publish(topic string, messages []MessageT, priority int) (ch chan []ResponseT, err error)

func (*PgNotifierT) Subscribe

func (notifier *PgNotifierT) Subscribe(topic string, channelSize int) (ch chan NotificationT, err error)

type ResponseT

type ResponseT struct {
	JobID  int64
	Status string
	Output json.RawMessage
	Error  string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL