Skip to content

Commit 185dbb8

Browse files
authored
InsertManyFast doc fixes for uniqueness (#609)
1 parent 18bcb34 commit 185dbb8

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

client.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,9 +1508,9 @@ func (c *Client[TTx]) insertManyParams(params []InsertManyParams) ([]*riverdrive
15081508
// // handle error
15091509
// }
15101510
//
1511-
// Job uniqueness is not respected when using InsertMany due to unique inserts
1512-
// using an internal transaction and advisory lock that might lead to
1513-
// significant lock contention. Insert unique jobs using Insert instead.
1511+
// Job uniqueness is supported using this path, but unlike with `InsertMany`
1512+
// unique conflicts cannot be handled gracefully. If a unique constraint is
1513+
// violated, the operation will fail and no jobs will be inserted.
15141514
func (c *Client[TTx]) InsertManyFast(ctx context.Context, params []InsertManyParams) (int, error) {
15151515
if !c.driver.HasPool() {
15161516
return 0, errNoDriverDBPool
@@ -1554,13 +1554,13 @@ func (c *Client[TTx]) InsertManyFast(ctx context.Context, params []InsertManyPar
15541554
// // handle error
15551555
// }
15561556
//
1557-
// Job uniqueness is not respected when using InsertManyTx due to unique inserts
1558-
// using an internal transaction and advisory lock that might lead to
1559-
// significant lock contention. Insert unique jobs using InsertTx instead.
1560-
//
15611557
// This variant lets a caller insert jobs atomically alongside other database
15621558
// changes. An inserted job isn't visible to be worked until the transaction
15631559
// commits, and if the transaction rolls back, so too is the inserted job.
1560+
//
1561+
// Job uniqueness is supported using this path, but unlike with `InsertManyTx`
1562+
// unique conflicts cannot be handled gracefully. If a unique constraint is
1563+
// violated, the operation will fail and no jobs will be inserted.
15641564
func (c *Client[TTx]) InsertManyFastTx(ctx context.Context, tx TTx, params []InsertManyParams) (int, error) {
15651565
insertParams, err := c.insertManyFastParams(params)
15661566
if err != nil {

0 commit comments

Comments
 (0)