mirror of
https://github.com/jackc/pgx.git
synced 2025-09-04 19:37:10 +00:00
Update for pgx v5
parent
28fe4c34fe
commit
4a88418606
@ -6,7 +6,7 @@ Import the following package:
|
|||||||
|
|
||||||
```go
|
```go
|
||||||
import (
|
import (
|
||||||
pgtypeuuid "github.com/jackc/pgtype/ext/gofrs-uuid"
|
pgxuuid "github.com/jackc/pgx-gofrs-uuid"
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -18,11 +18,7 @@ if err != nil {
|
|||||||
// handle error
|
// handle error
|
||||||
}
|
}
|
||||||
dbconfig.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error {
|
dbconfig.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error {
|
||||||
conn.ConnInfo().RegisterDataType(pgtype.DataType{
|
pgxuuid.Register(conn.TypeMap())
|
||||||
Value: &pgtypeuuid.UUID{},
|
|
||||||
Name: "uuid",
|
|
||||||
OID: pgtype.UUIDOID,
|
|
||||||
})
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user