Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ func encode(x interface{}, pgtypOid oid.Oid) []byte {
switch v := x.(type) {
case int64:
return []byte(fmt.Sprintf("%d", v))
case float32, float64:
return []byte(fmt.Sprintf("%f", v))
case float32:
return []byte(fmt.Sprintf("%.9f", v))
case float64:
return []byte(fmt.Sprintf("%.17f", v))
case []byte:
if pgtypOid == oid.T_bytea {
return []byte(fmt.Sprintf("\\x%x", v))
Expand Down Expand Up @@ -225,7 +227,7 @@ func parseBytea(s []byte) (result []byte) {
} else {
// unescaped, raw byte
i := bytes.IndexByte(s, '\\')
if (i == -1) {
if i == -1 {
result = append(result, s...)
break
}
Expand Down