Skip to content

Commit

Permalink
Drop lib/pq use in job listing
Browse files Browse the repository at this point in the history
I missed this before, but while working on something else I noticed
randomly that apparently we use `lib/pq` in the job list module to
encode an array of job states.

I think it was an oversight to have brought this in as a hard
dependency, so here remove the use of `pg.Array` in favor of just using
a normal Go slice instead.
  • Loading branch information
brandur committed May 4, 2024
1 parent 105a830 commit fa283f2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/dblist/db_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import (
"fmt"
"strings"

"github.com/lib/pq"

"github.com/riverqueue/river/internal/util/sliceutil"
"github.com/riverqueue/river/riverdriver"
"github.com/riverqueue/river/rivertype"
)
Expand Down Expand Up @@ -85,8 +84,7 @@ func JobList(ctx context.Context, exec riverdriver.Executor, params *JobListPara

if len(params.States) > 0 {
writeWhereOrAnd()
conditionsBuilder.WriteString("state = any(@states::river_job_state[])")
namedArgs["states"] = pq.Array(params.States)
namedArgs["states"] = sliceutil.Map(params.States, func(s rivertype.JobState) string { return string(s) })
}

if params.Conditions != "" {
Expand Down

0 comments on commit fa283f2

Please sign in to comment.