From 8b7c3507fe0c8f6e921ee2de2c170ef93eeb7275 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sun, 24 Oct 2021 13:14:37 +0200 Subject: upstep bun to v1.0.14 (#291) --- .../uptrace/bun/dialect/pgdialect/array_parser.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'vendor/github.com/uptrace/bun/dialect/pgdialect/array_parser.go') diff --git a/vendor/github.com/uptrace/bun/dialect/pgdialect/array_parser.go b/vendor/github.com/uptrace/bun/dialect/pgdialect/array_parser.go index 1c927fca0..0dff754f8 100644 --- a/vendor/github.com/uptrace/bun/dialect/pgdialect/array_parser.go +++ b/vendor/github.com/uptrace/bun/dialect/pgdialect/array_parser.go @@ -2,6 +2,7 @@ package pgdialect import ( "bytes" + "encoding/hex" "fmt" "io" ) @@ -109,11 +110,29 @@ func (p *arrayParser) readSubstring() ([]byte, error) { } continue } + if c == '\'' && next == '\'' { + p.buf = append(p.buf, next) + c, err = p.readByte() + if err != nil { + return nil, err + } + continue + } p.buf = append(p.buf, c) c = next } + if bytes.HasPrefix(p.buf, []byte("\\x")) && len(p.buf)%2 == 0 { + data := p.buf[2:] + buf := make([]byte, hex.DecodedLen(len(data))) + n, err := hex.Decode(buf, data) + if err != nil { + return nil, err + } + return buf[:n], nil + } + return p.buf, nil } -- cgit v1.2.3