summaryrefslogtreecommitdiff
path: root/vendor/github.com/jackc/pgproto3/v2/chunkreader.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/jackc/pgproto3/v2/chunkreader.go')
-rw-r--r--vendor/github.com/jackc/pgproto3/v2/chunkreader.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/github.com/jackc/pgproto3/v2/chunkreader.go b/vendor/github.com/jackc/pgproto3/v2/chunkreader.go
new file mode 100644
index 000000000..92206f358
--- /dev/null
+++ b/vendor/github.com/jackc/pgproto3/v2/chunkreader.go
@@ -0,0 +1,19 @@
+package pgproto3
+
+import (
+ "io"
+
+ "github.com/jackc/chunkreader/v2"
+)
+
+// ChunkReader is an interface to decouple github.com/jackc/chunkreader from this package.
+type ChunkReader interface {
+ // Next returns buf filled with the next n bytes. If an error (including a partial read) occurs,
+ // buf must be nil. Next must preserve any partially read data. Next must not reuse buf.
+ Next(n int) (buf []byte, err error)
+}
+
+// NewChunkReader creates and returns a new default ChunkReader.
+func NewChunkReader(r io.Reader) ChunkReader {
+ return chunkreader.New(r)
+}