From 185dbb85044208a42ccccc9827ea4e91d499fdc4 Mon Sep 17 00:00:00 2001 From: Blake Gentry Date: Sun, 22 Sep 2024 21:09:38 -0500 Subject: [PATCH] InsertManyFast doc fixes for uniqueness (#609) --- client.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/client.go b/client.go index 1a4a39d9..d23959ec 100644 --- a/client.go +++ b/client.go @@ -1508,9 +1508,9 @@ func (c *Client[TTx]) insertManyParams(params []InsertManyParams) ([]*riverdrive // // handle error // } // -// Job uniqueness is not respected when using InsertMany due to unique inserts -// using an internal transaction and advisory lock that might lead to -// significant lock contention. Insert unique jobs using Insert instead. +// Job uniqueness is supported using this path, but unlike with `InsertMany` +// unique conflicts cannot be handled gracefully. If a unique constraint is +// violated, the operation will fail and no jobs will be inserted. func (c *Client[TTx]) InsertManyFast(ctx context.Context, params []InsertManyParams) (int, error) { if !c.driver.HasPool() { return 0, errNoDriverDBPool @@ -1554,13 +1554,13 @@ func (c *Client[TTx]) InsertManyFast(ctx context.Context, params []InsertManyPar // // handle error // } // -// Job uniqueness is not respected when using InsertManyTx due to unique inserts -// using an internal transaction and advisory lock that might lead to -// significant lock contention. Insert unique jobs using InsertTx instead. -// // This variant lets a caller insert jobs atomically alongside other database // changes. An inserted job isn't visible to be worked until the transaction // commits, and if the transaction rolls back, so too is the inserted job. +// +// Job uniqueness is supported using this path, but unlike with `InsertManyTx` +// unique conflicts cannot be handled gracefully. If a unique constraint is +// violated, the operation will fail and no jobs will be inserted. func (c *Client[TTx]) InsertManyFastTx(ctx context.Context, tx TTx, params []InsertManyParams) (int, error) { insertParams, err := c.insertManyFastParams(params) if err != nil {