This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Version 5 of pgx introduced several breaking changes that affected our code base. You can read more about them here: https://github.com/jackc/pgx/blob/29ad306e47c491a0ecc52d502241539aedd636bd/CHANGELOG.md#codec-and-value-split In summary: - NULL Representation > Previously, types had a Status field that could be Undefined, Null, or > Present. This has been changed to a Valid bool field to harmonize with > how database/sql represents NULL and to make the zero value useable. - Codec and Value Split > Previously, the type system combined decoding and encoding values with > the value types... > This concepts have been separated. A Codec only has responsibility for > encoding and decoding values. Value types are generally defined by > implementing an interface that a particular Codec understands (e.g. > PointScanner and PointValuer for the PostgreSQL point type). - Array Types > All array types are now handled by ArrayCodec instead of using code > generation for each new array type... - Other Changes > JSON and JSONB types removed. Use []byte or string directly. There are some changes that don't seem to appear in the CHANGELOG: - An error is returned when scanning NULL into a variable that can't handle nil values. For example, scanning NULL into an int64. - Custom types must be register into the connection's `typeMap *pgtype.Map`, otherwise, an error will be returned when the encoding/decoding plan is not found for the custom type OID. - Requires go 1.18 since it uses generics for some features, like arrays. To deal with the custom types, we added the register logic in the `afterConnect` method of the pool. Every time a connection is created a new pgtype.Map is generated with all the default PostgreSQL, meaning that whenever a connection is created, we need to register our custom types with it.
- Loading branch information
1 parent
f795fe5
commit ca19e2f
Showing
115 changed files
with
1,082 additions
and
1,112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.