MCPcopy Index your code
hub / github.com/riverqueue/river / JobDeleteMany

Method JobDeleteMany

riverdriver/riversqlite/river_sqlite_driver.go:411–428  ·  view source on GitHub ↗
(ctx context.Context, params *riverdriver.JobDeleteManyParams)

Source from the content-addressed store, hash-verified

409}
410
411func (e *Executor) JobDeleteMany(ctx context.Context, params *riverdriver.JobDeleteManyParams) ([]*rivertype.JobRow, error) {
412 ctx = sqlctemplate.WithReplacements(ctx, map[string]sqlctemplate.Replacement{
413 "order_by_clause": {Value: params.OrderByClause},
414 "where_clause": {Value: params.WhereClause},
415 }, params.NamedArgs)
416
417 jobs, err := dbsqlc.New().JobDeleteMany(schemaTemplateParam(ctx, params.Schema), e.dbtx, int64(params.Max))
418 if err != nil {
419 return nil, interpretError(err)
420 }
421 // This is unfortunate. SQLite doesn't support `DELETE` in CTEs, so there's
422 // no way to get reliable ordering back. It has a non-standard `ORDER BY`
423 // statement in `DELETE`, but this is only used to determine what fits
424 // inside `LIMIT`, and again not guaranteed to be the order returned by
425 // `RETURNING`. Here, order post-operation before returning from driver.
426 slices.SortFunc(jobs, func(j1, j2 *dbsqlc.RiverJob) int { return int(j1.ID - j2.ID) })
427 return sliceutil.MapError(jobs, jobRowFromInternal)
428}
429
430// This really sucks, but this SQL fragment's been extracted to a string because
431// sqlc is buggy and can't parse it.

Callers

nothing calls this directly

Implementers 3

Executorriverdriver/riverpgxv5/river_pgx_v5_dr
Executorriverdriver/riverdatabasesql/river_dat
Executorriverdriver/riversqlite/river_sqlite_d

Calls 6

WithReplacementsFunction · 0.92
NewFunction · 0.92
MapErrorFunction · 0.92
schemaTemplateParamFunction · 0.70
interpretErrorFunction · 0.70
JobDeleteManyMethod · 0.65

Tested by

no test coverage detected