Skip to content
This repository was archived by the owner on Nov 20, 2023. It is now read-only.

Commit a2e2d4c

Browse files
committed
document Enqueue and EnqueueInTx
1 parent 4423782 commit a2e2d4c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

que.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,17 @@ func NewClient(pool *pgx.ConnPool) *Client {
105105

106106
var ErrMissingType = errors.New("job type must be specified")
107107

108+
// Enqueue adds a job to the queue.
108109
func (c *Client) Enqueue(j Job) error {
109110
return execEnqueue(j, c.pool)
110111
}
111112

113+
// EnqueueInTx adds a job to the queue within the scope of the transaction tx.
114+
// This allows you to guarantee that an enqueued job will either be committed or
115+
// rolled back atomically with other changes in the course of this transaction.
116+
//
117+
// It is the caller's responsibility to Commit or Rollback the transaction after
118+
// this function is called.
112119
func (c *Client) EnqueueInTx(j Job, tx *pgx.Tx) error {
113120
return execEnqueue(j, tx)
114121
}

0 commit comments

Comments
 (0)