kysely-data-api icon indicating copy to clipboard operation
kysely-data-api copied to clipboard

fix(driver): return Object for JSON columns and imply UTC for timestampz

Open omikader opened this issue 8 months ago • 1 comments

Summary

This PR does a couple of things:

  • Removes the yarn.lock file and references to yarn in the package.json scripts because this uses pnpm for the GitHub actions and everything else
  • Changes the DataApiConnection.executeQuery logic to be more type-savvy in the following ways:
    • The current implementation converts all date timestamp and timestamptz columns into Date objects. However, in Postgres, timestamptz columns are always stored in UTC and are converted to the system timezone upon retrieval. Therefore, implied UTC needs to be added to ensure that the Date object is correct https://github.com/sst/kysely-data-api/issues/34
    • The current implementation is capable of returning POJOs for json and jsonb columns. This relieves us of needing to use the ParseJSONResultsPlugin which incorrectly and eagerly convert non-JSON column types into JSON. Given that the column type is available here, I think it makes a lot of sense to use that information

Given that this changes the return types, I've opted for a major version bump.

omikader avatar Jun 04 '24 21:06 omikader