-
Notifications
You must be signed in to change notification settings - Fork 854
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify registration of custom types with pgxpool
Sometimes pgx is not capable of inferring the correct codec by inspecting the database, as is done with LoadType(s), and requires a user-defined operation to be performed instead. To allow these custom types to also benefit from connection initialisation, it is possible to register these functions with pgxpool using the new RegisterCustomType method. When using the default configuration, this will still require each new connection to perform one query to the backend to retrieve the OIDs for these custom types. This is already a benefit, instead of requiring a query for each custom type, with the associated latency. Even better, when the reuseTypeMap pgxpool configuration is selected, only the first connection requires this query; subsequent connections will execute the custom registration code, using the cached OID mapping.
- Loading branch information
Showing
1 changed file
with
99 additions
and
21 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