mirror of https://github.com/jackc/pgx.git
Remove unused code
parent
a636ef31a4
commit
015108be9a
35
values.go
35
values.go
|
@ -111,9 +111,13 @@ func encodePreparedStatementArgument(wbuf *WriteBuf, oid pgtype.Oid, arg interfa
|
||||||
}
|
}
|
||||||
return encodePreparedStatementArgument(wbuf, oid, v)
|
return encodePreparedStatementArgument(wbuf, oid, v)
|
||||||
case string:
|
case string:
|
||||||
return encodeString(wbuf, oid, arg)
|
wbuf.WriteInt32(int32(len(arg)))
|
||||||
|
wbuf.WriteBytes([]byte(arg))
|
||||||
|
return nil
|
||||||
case []byte:
|
case []byte:
|
||||||
return encodeByteSlice(wbuf, oid, arg)
|
wbuf.WriteInt32(int32(len(arg)))
|
||||||
|
wbuf.WriteBytes(arg)
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
refVal := reflect.ValueOf(arg)
|
refVal := reflect.ValueOf(arg)
|
||||||
|
@ -214,26 +218,6 @@ func stripNamedType(val *reflect.Value) (interface{}, bool) {
|
||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
func decodeText(vr *ValueReader) string {
|
|
||||||
if vr.Len() == -1 {
|
|
||||||
vr.Fatal(ProtocolError("Cannot decode null into string"))
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
if vr.Type().FormatCode == BinaryFormatCode {
|
|
||||||
vr.Fatal(ProtocolError("cannot decode binary value into string"))
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return vr.ReadString(vr.Len())
|
|
||||||
}
|
|
||||||
|
|
||||||
func encodeString(w *WriteBuf, oid pgtype.Oid, value string) error {
|
|
||||||
w.WriteInt32(int32(len(value)))
|
|
||||||
w.WriteBytes([]byte(value))
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func decodeBytea(vr *ValueReader) []byte {
|
func decodeBytea(vr *ValueReader) []byte {
|
||||||
if vr.Len() == -1 {
|
if vr.Len() == -1 {
|
||||||
return nil
|
return nil
|
||||||
|
@ -251,10 +235,3 @@ func decodeBytea(vr *ValueReader) []byte {
|
||||||
|
|
||||||
return vr.ReadBytes(vr.Len())
|
return vr.ReadBytes(vr.Len())
|
||||||
}
|
}
|
||||||
|
|
||||||
func encodeByteSlice(w *WriteBuf, oid pgtype.Oid, value []byte) error {
|
|
||||||
w.WriteInt32(int32(len(value)))
|
|
||||||
w.WriteBytes(value)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue