Remove oid constants from pgx

v3-numeric-wip
Jack Christensen 2017-03-18 14:59:14 -05:00
parent 6f0ec4c470
commit 9ab59a74a9
5 changed files with 17 additions and 60 deletions

View File

@ -38,10 +38,10 @@ var minimalConnInfo *pgtype.ConnInfo
func init() {
minimalConnInfo = pgtype.NewConnInfo()
minimalConnInfo.InitializeDataTypes(map[string]pgtype.Oid{
"int4": Int4Oid,
"name": NameOid,
"oid": OidOid,
"text": TextOid,
"int4": pgtype.Int4Oid,
"name": pgtype.NameOid,
"oid": pgtype.OidOid,
"text": pgtype.TextOid,
})
}

View File

@ -1043,7 +1043,7 @@ func TestPrepareEx(t *testing.T) {
conn := mustConnect(t, *defaultConnConfig)
defer closeConn(t, conn)
_, err := conn.PrepareEx("test", "select $1", &pgx.PrepareExOptions{ParameterOids: []pgtype.Oid{pgx.TextOid}})
_, err := conn.PrepareEx("test", "select $1", &pgx.PrepareExOptions{ParameterOids: []pgtype.Oid{pgtype.TextOid}})
if err != nil {
t.Errorf("Unable to prepare statement: %v", err)
return

View File

@ -66,16 +66,16 @@ func init() {
sql.Register("pgx", d)
databaseSqlOids = make(map[pgtype.Oid]bool)
databaseSqlOids[pgx.BoolOid] = true
databaseSqlOids[pgx.ByteaOid] = true
databaseSqlOids[pgx.Int2Oid] = true
databaseSqlOids[pgx.Int4Oid] = true
databaseSqlOids[pgx.Int8Oid] = true
databaseSqlOids[pgx.Float4Oid] = true
databaseSqlOids[pgx.Float8Oid] = true
databaseSqlOids[pgx.DateOid] = true
databaseSqlOids[pgx.TimestampTzOid] = true
databaseSqlOids[pgx.TimestampOid] = true
databaseSqlOids[pgtype.BoolOid] = true
databaseSqlOids[pgtype.ByteaOid] = true
databaseSqlOids[pgtype.Int2Oid] = true
databaseSqlOids[pgtype.Int4Oid] = true
databaseSqlOids[pgtype.Int8Oid] = true
databaseSqlOids[pgtype.Float4Oid] = true
databaseSqlOids[pgtype.Float8Oid] = true
databaseSqlOids[pgtype.DateOid] = true
databaseSqlOids[pgtype.TimestamptzOid] = true
databaseSqlOids[pgtype.TimestampOid] = true
}
type Driver struct {

2
v3.md
View File

@ -30,6 +30,8 @@ Remove CopyTo
No longer can read raw bytes of any value into a []byte. Use pgtype.GenericBinary if this functionality is needed.
OID constants moved from pgx to pgtype package
## TODO / Possible / Investigate
Organize errors better

View File

@ -9,51 +9,6 @@ import (
"github.com/jackc/pgx/pgtype"
)
// PostgreSQL oids for common types
const (
BoolOid = 16
ByteaOid = 17
CharOid = 18
NameOid = 19
Int8Oid = 20
Int2Oid = 21
Int4Oid = 23
TextOid = 25
OidOid = 26
TidOid = 27
XidOid = 28
CidOid = 29
JsonOid = 114
CidrOid = 650
CidrArrayOid = 651
Float4Oid = 700
Float8Oid = 701
UnknownOid = 705
InetOid = 869
BoolArrayOid = 1000
Int2ArrayOid = 1005
Int4ArrayOid = 1007
TextArrayOid = 1009
ByteaArrayOid = 1001
VarcharArrayOid = 1015
Int8ArrayOid = 1016
Float4ArrayOid = 1021
Float8ArrayOid = 1022
AclitemOid = 1033
AclitemArrayOid = 1034
InetArrayOid = 1041
VarcharOid = 1043
DateOid = 1082
TimestampOid = 1114
TimestampArrayOid = 1115
DateArrayOid = 1182
TimestampTzOid = 1184
TimestampTzArrayOid = 1185
RecordOid = 2249
UuidOid = 2950
JsonbOid = 3802
)
// PostgreSQL format codes
const (
TextFormatCode = 0