Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof of concept: River operating with pgx simple protocol #234

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions internal/riverinternaltest/riverinternaltest.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func DatabaseConfig(databaseName string) *pgxpool.Config {
// are unlikely to succeed even with more time:
config.ConnConfig.ConnectTimeout = 2 * time.Second
config.ConnConfig.RuntimeParams["timezone"] = "UTC"
config.ConnConfig.DefaultQueryExecMode = pgx.QueryExecModeSimpleProtocol
return config
}

Expand Down
5 changes: 2 additions & 3 deletions riverdriver/riverdatabasesql/internal/dbsqlc/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 11 additions & 12 deletions riverdriver/riverdatabasesql/internal/dbsqlc/river_job.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions riverdriver/riverdatabasesql/internal/dbsqlc/sqlc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ sql:
ttl: "TTL"

overrides:
- db_type: "jsonb"
go_type: "string"

- db_type: "jsonb"
go_type:
type: "string"
pointer: true
nullable: true

- db_type: "pg_catalog.interval"
go_type: "time.Duration"

Expand All @@ -40,14 +49,6 @@ sql:

# specific columns

# This one is necessary because `args` is nullable (this seems to have
# been an oversight, but one we're determined isn't worth correcting
# for now), and the `database/sql` variant of sqlc will give it a
# crazy type by default, so here we give it something more reasonable.
- column: "river_job.args"
go_type:
type: "[]byte"

- column: "river_job.errors"
go_type:
type: "[]AttemptError"
4 changes: 2 additions & 2 deletions riverdriver/riverpgxv5/internal/dbsqlc/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions riverdriver/riverpgxv5/internal/dbsqlc/river_job.sql
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ INSERT INTO river_job(
@finalized_at,
@kind::text,
@max_attempts::smallint,
coalesce(@metadata::jsonb, '{}'),
coalesce(sqlc.narg('metadata')::jsonb, '{}'),
@priority::smallint,
@queue::text,
coalesce(sqlc.narg('scheduled_at')::timestamptz, now()),
Expand All @@ -199,7 +199,7 @@ INSERT INTO river_job(
state,
tags
) VALUES (
@args::jsonb,
@args,
coalesce(@attempt::smallint, 0),
@attempted_at,
coalesce(sqlc.narg('created_at')::timestamptz, now()),
Expand Down
22 changes: 11 additions & 11 deletions riverdriver/riverpgxv5/internal/dbsqlc/river_job.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions riverdriver/riverpgxv5/internal/dbsqlc/sqlc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ sql:
- db_type: "pg_catalog.interval"
go_type: "time.Duration"

- db_type: "jsonb"
go_type: "string"

- db_type: "jsonb"
go_type:
type: "string"
pointer: true
nullable: true

- db_type: "timestamptz"
go_type: "time.Time"

Expand Down
Loading
Loading