You've already forked go-clickhouse
mirror of
https://github.com/uptrace/go-clickhouse.git
synced 2025-06-29 00:21:46 +02:00
chore: append bytes like a string. Fixes #43
This commit is contained in:
@ -2,11 +2,12 @@ package chschema
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql/driver"
|
"database/sql/driver"
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/uptrace/go-clickhouse/ch/internal"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Append(fmter Formatter, b []byte, v any) []byte {
|
func Append(fmter Formatter, b []byte, v any) []byte {
|
||||||
@ -116,16 +117,5 @@ func AppendBytes(b []byte, bytes []byte) []byte {
|
|||||||
if bytes == nil {
|
if bytes == nil {
|
||||||
return AppendNull(b)
|
return AppendNull(b)
|
||||||
}
|
}
|
||||||
|
return AppendString(b, internal.String(bytes))
|
||||||
b = append(b, '\'')
|
|
||||||
|
|
||||||
tmp := make([]byte, hex.EncodedLen(len(bytes)))
|
|
||||||
hex.Encode(tmp, bytes)
|
|
||||||
|
|
||||||
b = append(b, "\\x"...)
|
|
||||||
b = append(b, tmp...)
|
|
||||||
|
|
||||||
b = append(b, '\'')
|
|
||||||
|
|
||||||
return b
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user