-
| 
         Hi, I'm trying to migrate a project to google uuid library. I'm using  import (
  "github.com/jackc/pgtype"
  pgtypeuuid "github.com/jackc/pgtype/ext/gofrs-uuid"
  "github.com/jackc/pgx/v4"
  "github.com/jackc/pgx/v4/pgxpool"
)
config, err := pgxpool.ParseConfig(dbUrlWithMaxConnections)
if err != nil {
	log.Fatal().Err(err).Msg("Unable to open config connection pool")
}
config.AfterConnect = func(ctx context.Context, conn *pgx.Conn) error {
	conn.ConnInfo().RegisterDataType(pgtype.DataType{
		Value: &pgtypeuuid.UUID{},
		Name:  "uuid",
		OID:   pgtype.UUIDOID,
	})
	return nil
}
dbPool, err := pgxpool.ConnectConfig(context.Background(), config) | 
  
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            jackc
          
      
      
        Jan 24, 2023 
      
    
    Replies: 1 comment 1 reply
-
| 
         pgx v4 does not have a built-in adapter for the Google UUID library. It still work though (albeit a little slower) -- pgx v4 is compatible with database/sql  And there is a 3rd party adapter for pgx v5 https://github.com/vgarvardt/pgx-google-uuid.  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            
      Answer selected by
        soasada
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
pgx v4 does not have a built-in adapter for the Google UUID library. It still work though (albeit a little slower) -- pgx v4 is compatible with database/sql
ScannerandValuer.And there is a 3rd party adapter for pgx v5 https://github.com/vgarvardt/pgx-google-uuid.