Skip to content

Conversation

@brandur
Copy link
Contributor

@brandur brandur commented Jul 6, 2024

Previously, the internal sqlc RiverJob row was fully typed by virtue
of being generated by sqlc, but the riverqueue.Job type was undefined,
with typechecks working by using a cast.

Here, give riverqueue.Job a full set of defined properties. This is
better for things like conveying type information and autocomplete, but
has a few other side benefits:

  • Make sure to return all timestamps as UTC. Previously, they'd be in
    whatever your local timezone is.

  • Give some fields like args, metadata, and state better types
    (the first two were previously Any).

Lastly, modify InsertResult somewhat to make job non-optional since
it's always returned, even if insert was skipped, because if it was we
look it up via select query.

@brandur brandur force-pushed the brandur-job-properties branch from 8971a6d to ff8b893 Compare July 6, 2024 16:31
Previously, the internal sqlc `RiverJob` row was fully typed by virtue
of being generated by sqlc, but the `riverqueue.Job` type was undefined,
with typechecks working by using a `cast`.

Here, give `riverqueue.Job` a full set of defined properties. This is
better for things like conveying type information and autocomplete, but
has a few other side benefits:

* Make sure to return all timestamps as UTC. Previously, they'd be in
  whatever your local timezone is.

* Give some fields like `args`, `metadata`, and `state` better types
  (the first two were previously `Any`).

Lastly, modify `InsertResult` somewhat to make `job` non-optional since
it's always returned, even if insert was skipped, because if it was we
look it up via select query.
@brandur brandur force-pushed the brandur-job-properties branch from ff8b893 to 812b27c Compare July 6, 2024 16:33
@brandur brandur merged commit a258b1f into master Jul 6, 2024
@brandur brandur deleted the brandur-job-properties branch July 6, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants