Update for pgx v5

Jack Christensen 2022-09-17 08:45:17 -05:00
parent e7c1e19282
commit 28fe4c34fe

@ -7,17 +7,13 @@ The recommended solution is to use the [github.com/shopspring/decimal](https://g
To use it add the following line to your imports:
```go
shopspring "github.com/jackc/pgtype/ext/shopspring-numeric"
pgxdecimal "github.com/jackc/pgx-shopspring-decimal"
```
Then run the following to register the data type with a connection:
```go
conn.ConnInfo().RegisterDataType(pgtype.DataType{
Value: &shopspring.Numeric{},
Name: "numeric",
OID: pgtype.NumericOID,
})
pgxdecimal.Register(conn.TypeMap())
```
If you are using `pgxpool` the previous command should be run in an `AfterConnect` hook to ensure it is available on every connection.