mirror of https://github.com/jackc/pgx.git
Rename NullHstore value to Hstore
Ensure consistency with other Null* typespull/37/head
parent
890357732b
commit
274a14fe73
|
@ -489,7 +489,7 @@ func (h Hstore) Encode(w *WriteBuf, oid Oid) error {
|
||||||
// If any of the NullString values in Store has Valid set to false, the key
|
// If any of the NullString values in Store has Valid set to false, the key
|
||||||
// appears in the hstore column, but its value is explicitly set to NULL
|
// appears in the hstore column, but its value is explicitly set to NULL
|
||||||
type NullHstore struct {
|
type NullHstore struct {
|
||||||
Store map[string]NullString
|
Hstore map[string]NullString
|
||||||
Valid bool
|
Valid bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ func (h *NullHstore) Scan(vr *ValueReader) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
h.Valid = true
|
h.Valid = true
|
||||||
h.Store = store
|
h.Hstore = store
|
||||||
return nil
|
return nil
|
||||||
case BinaryFormatCode:
|
case BinaryFormatCode:
|
||||||
vr.Fatal(ProtocolError("Can't decode binary hstore"))
|
vr.Fatal(ProtocolError("Can't decode binary hstore"))
|
||||||
|
@ -535,7 +535,7 @@ func (h NullHstore) Encode(w *WriteBuf, oid Oid) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
i := 0
|
i := 0
|
||||||
for k, v := range h.Store {
|
for k, v := range h.Hstore {
|
||||||
i++
|
i++
|
||||||
ks := strings.Replace(k, `\`, `\\`, -1)
|
ks := strings.Replace(k, `\`, `\\`, -1)
|
||||||
ks = strings.Replace(ks, `"`, `\"`, -1)
|
ks = strings.Replace(ks, `"`, `\"`, -1)
|
||||||
|
@ -546,7 +546,7 @@ func (h NullHstore) Encode(w *WriteBuf, oid Oid) error {
|
||||||
} else {
|
} else {
|
||||||
buf.WriteString(fmt.Sprintf(`"%s"=>NULL`, ks))
|
buf.WriteString(fmt.Sprintf(`"%s"=>NULL`, ks))
|
||||||
}
|
}
|
||||||
if i < len(h.Store) {
|
if i < len(h.Hstore) {
|
||||||
buf.WriteString(", ")
|
buf.WriteString(", ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue