Skip to content

Releases: vapor/postgres-nio

PostgresNIO 1.8.0 (async/await)

11 Mar 14:38
57fda42

Choose a tag to compare

This release adds Swift structured concurrency APIs (async/await). It is now possible to run queries like this:

let role = "admin"
let rows = try await connection.query("SELECT id, username, birthday FROM users WHERE role = \(role)", logger: logger)
for try await (id, username, birthday) in rows.decode((Int, String, Date).self, context: .default) {
  // do something with the returned values
}

For more information please read the updated README.

What's Changed

  • Fix typo in README.md by @flix477 in #208
  • Remove PSQLJSONDecoder from PSQLConnection in #214
  • Merge type PSQLFormat into PostgresFormat in #212
  • Remove PSQLJSONDecoder in #216
  • Merge PSQLDataType with PostgresDataType in #213
  • Remove PSQLJSONEncoder in #215
  • PSQLDecodingError improvements in #211
  • Add async option to PSQLRowStream in #206
  • Make PSQLDecodingContext generic in #217
  • Cut back on number of CI jobs in #218
  • Extend PostgresCastingError in #221
  • Add PostgresCell in #220
  • Add PSQLRow multi decode in #222
  • Add PostgresQuery in #223
  • Rename PSQLDecodable to PostgresDecodable in #224
  • Rename PSQLCodable to PostgresCodable in #225
  • Rename PSQLRowSequence to PostgresRowSequence in #226
  • Rename PSQLEncodingContext to PostgresEncodingContext in #227
  • Move all PostgresConnection code into one file in #228
  • Deprecate unused postgres messages in #229
  • Cleanup encoding and decoding in #230
  • Merge PSQLRow into PostgresRow in #219
  • Replace all EncoderContext/DecoderContext uses of .forTests with .default in #231
  • Add an async query API (internal for now) in #233
  • Add PostgresRowSequence multi decode in #232
  • [BufferMessageEncoder] Reduce the number of force unwraps in #234
  • [PostgresRowSequence] Make StateMachine private in #235
  • Rename PSQLRow multi decode to PostgresRow multi decode in #236
  • Explicit TLS config in #237
  • Rename PSQLFrontendMessage to PostgresFrontendMessage in #239
  • Rename PSQLBackendMessage to PostgresBackendMessage in #238
  • Merge PSQLConnection into PostgresConnection in #240
  • Cleanup PostgresDecodable in #241
  • Make PostgresEncodingContext & PostgresDecodingContext public in #243
  • Add Sendable checking in #242
  • Add good first issue project board workflow to repository by @BennyDeBock in #246
  • New PostgresConnection connect API in #245
  • Make new Postgres decoding public in #244
  • Make PostgresRowSequence public in #247
  • Make Postgres Encodable public in #248
  • Make Postgres async query public in #249
  • Rename PostgresBackendMessageDecoder in #252
  • Add support for Network.framework in #253
  • Make DataRow Sendable in #250
  • Rename PostgresChannelHandler in #251
  • README update for async/await in #254
  • Fix missing links in #255

New Contributors

Full Changelog: 1.7.2...1.8.0

Refactor PSQLRowStream to make async/await easier

26 Nov 23:30
780a510

Choose a tag to compare

This patch was authored and released by @fabianfett.

Motivation

PSQLRowStream's current implementation is interesting. It should be better tested and easier to follow for async/await support later.

Changes

  • Make PSQLRowStream's implementation more sensible
  • Add unit tests for PSQLRowStream

Result

Adding async/await support becomes easier.

Faster decoding, thanks to fewer bound checks.

26 Nov 23:06
81ca909

Choose a tag to compare

This patch was authored by @fabianfett and released by @gwynne.

Motivation

We like faster code. This removes a ton of unnecessary bounds checks.

Result

Faster code

In draft since it requires a new NIO release.

Add proper support for `Decimal`

24 Nov 18:47
2c49bee

Choose a tag to compare

This patch was authored by @madsodgaard and released by @gwynne.

Fixes an issue when trying to decode/encode numeric columns as Decimal, that would result in an error such as: server: column "balance" is of type numeric but expression is of type text (transformAssignedExpr).

ByteBuffer extension, prevent naming conflicts

23 Nov 13:18
3931a06

Choose a tag to compare

This patch was authored and released by @fabianfett.

Motivation

We currently extend ByteBuffer with non prefixed utility methods. This may lead to breaking code, if NIO introduces those utilities itself. As potentially planned here: apple/swift-nio#1990

Changes

Prefix all ByteBuffer utility methods

Result

Chances reduced of breaking code.

DataRow without allocation; DataRow as Collection; RowDescription top level

22 Nov 10:24
1042870

Choose a tag to compare

This patch was authored and released by @fabianfett.

This is a cherry pick of #188.

Modifications

  • DataRow and RowDescription have been moved out of the PSQLBackendMessage namespace. This allows us to mark them as @inlinable or @usableFromInline at a later point, without marking everything in PSQLBackendMessage as @inlinable
  • DataRow does not use an internal array for its columns anymore. Instead all read operations are directly done on its ByteBuffer slice.
  • DataRow implements the Collection protocol now.

Result

One allocation fewer per queried row.

Make password hashing fast

21 Oct 07:12
c5eda6c

Choose a tag to compare

This patch was authored by @fabianfett and released by @gwynne.

This is just a really quick patch to reduce the 320 allocations we have for hashing the password to something sensible (less than 10).

Result

In allocation analysis, password hashing doesn't appear as a biggy anymore.

PostgresNIO 1.6.2

23 Sep 18:09
046d3ba

Choose a tag to compare

Semver Patch

  • PSQLBackendMessageDecoder is a SingleStepDecoder (#174)
  • Add conveniences to PSQLFrontendMessage (#173)
  • Add RowStreamStateMachine (#176)
  • Extract PSQLRow (#177)
  • Add BufferedMessageEncoder, fix PSQLFrontendMessageEncoder (#179)
  • Batch rows for consumption (#180)
  • Depend on Swift Crypto "1.0.0" ..< "3.0.0" (#183)
  • Move Decoding into PSQLChannelHandler (#182)
  • Move message encoding into PSQLChannelHandler (#181)
  • Bump SwiftNIO dependency to 2.33.0 (#184)

Other changes

  • Add PSQLBackendMessageEncoder (#175)
  • Add PSQLFrontendMessageDecoder (#178)

PostgresNIO 1.6.1

19 Aug 14:50
6a9eb6f

Choose a tag to compare

SemVer Patch

  • Fix NIOSSL deprecation warnings (#168) (patch credit to @jareyesda)
  • Fix NIO imports (#171)

Other Changes

  • Splits CI Jobs Into Unit And Integration Tests On Linux (#169) (patch credit to @dnadoba)

1.6.0

28 Jul 16:43
1d37934

Choose a tag to compare

  • Add platform requirements for iOS, watchOS and tvOS (#154)
  • Update api-docs.yml (#156) Thanks @JaapWijnen
  • Split out IntegrationTests into separate testTarget (#157)
  • Use sync pipeline operations, update NIO dependencies (#152)
  • Add one Auth and one SSL test case (#159)
  • Fix API docs link. Resolves (#163)
  • Add link to our SECURITY.md (#164)
  • Use PSQLFormat when encoding and decoding (#158)
  • Support AWS Redshift queries - SELECT Metadata without row number (#167) Thanks @grennis