mirror of
https://github.com/jackc/pgx.git
synced 2025-07-08 19:49:23 +00:00
Previously if we provided a parameter that was an array of strings such as []string{"0.0.0.0/8"}, we would encode this when sending to Postgres as ::ffff:0.0.0.0/8. From what I can tell, this is because when parsing the IP/network using net functions, we get a byte array that is 16 bytes long, even if it is an IPv4 network. In Inet.EncodeBinary(), we look at the length of the IP to determine what family the input is, and saw it as IPv6 because of this. We now always normalize IPv4 addresses using To4().
pgtype
pgtype implements Go types for over 70 PostgreSQL types. pgtype is the type system underlying the
https://github.com/jackc/pgx PostgreSQL driver. These types support the binary format for enhanced performance with pgx.
They also support the database/sql Scan
and Value
interfaces and can be used with https://github.com/lib/pq.
Languages
Go
98.6%
HTML
1.2%
Shell
0.2%