diff options
author | 2021-08-25 15:34:33 +0200 | |
---|---|---|
committer | 2021-08-25 15:34:33 +0200 | |
commit | 2dc9fc1626507bb54417fc4a1920b847cafb27a2 (patch) | |
tree | 4ddeac479b923db38090aac8bd9209f3646851c1 /vendor/github.com/go-pg/pg/v10/internal/parser/streaming_parser.go | |
parent | Manually approves followers (#146) (diff) | |
download | gotosocial-2dc9fc1626507bb54417fc4a1920b847cafb27a2.tar.xz |
Pg to bun (#148)
* start moving to bun
* changing more stuff
* more
* and yet more
* tests passing
* seems stable now
* more big changes
* small fix
* little fixes
Diffstat (limited to 'vendor/github.com/go-pg/pg/v10/internal/parser/streaming_parser.go')
-rw-r--r-- | vendor/github.com/go-pg/pg/v10/internal/parser/streaming_parser.go | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/vendor/github.com/go-pg/pg/v10/internal/parser/streaming_parser.go b/vendor/github.com/go-pg/pg/v10/internal/parser/streaming_parser.go deleted file mode 100644 index 723c12b16..000000000 --- a/vendor/github.com/go-pg/pg/v10/internal/parser/streaming_parser.go +++ /dev/null @@ -1,65 +0,0 @@ -package parser - -import ( - "fmt" - - "github.com/go-pg/pg/v10/internal/pool" -) - -type StreamingParser struct { - pool.Reader -} - -func NewStreamingParser(rd pool.Reader) StreamingParser { - return StreamingParser{ - Reader: rd, - } -} - -func (p StreamingParser) SkipByte(skip byte) error { - c, err := p.ReadByte() - if err != nil { - return err - } - if c == skip { - return nil - } - _ = p.UnreadByte() - return fmt.Errorf("got %q, wanted %q", c, skip) -} - -func (p StreamingParser) ReadSubstring(b []byte) ([]byte, error) { - c, err := p.ReadByte() - if err != nil { - return b, err - } - - for { - if c == '"' { - return b, nil - } - - next, err := p.ReadByte() - if err != nil { - return b, err - } - - if c == '\\' { - switch next { - case '\\', '"': - b = append(b, next) - c, err = p.ReadByte() - if err != nil { - return nil, err - } - default: - b = append(b, '\\') - c = next - } - continue - } - - b = append(b, c) - c = next - } -} |