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

Method Where

job_list_params.go:451–467  ·  view source on GitHub ↗

Where is an all-encompassing query escape hatch that adds an arbitrary predicate after a list query's `WHERE ...` clause. Use of other JobListParams filters should be preferred where possible because they're safer and their compatibility between drivers is better guaranteed, but in case none is suit

(sql string, namedArgsMany ...NamedArgs)

Source from the content-addressed store, hash-verified

449// unsanitized user input into a SQL string, and use named parameters to curb
450// the likelihood of injection.
451func (p *JobListParams) Where(sql string, namedArgsMany ...NamedArgs) *JobListParams {
452 paramsCopy := p.copy()
453
454 var allNamedArgs NamedArgs
455 if len(namedArgsMany) > 0 {
456 for i, namedArgs := range namedArgsMany {
457 if i == 0 {
458 allNamedArgs = namedArgs
459 } else {
460 maps.Copy(allNamedArgs, namedArgs)
461 }
462 }
463 }
464
465 paramsCopy.where = append(paramsCopy.where, dblist.WherePredicate{NamedArgs: allNamedArgs, SQL: sql})
466 return paramsCopy
467}
468
469func jobListTimeFieldForState(state rivertype.JobState) string {
470 // Don't include a `default` so `exhaustive` lint can detect omissions.

Callers 2

ExerciseClientFunction · 0.95
Test_Client_JobListFunction · 0.80

Calls 1

copyMethod · 0.95

Tested by 2

ExerciseClientFunction · 0.76
Test_Client_JobListFunction · 0.64