chunkreader.go (561B)
1 package pgproto3 2 3 import ( 4 "io" 5 6 "github.com/jackc/chunkreader/v2" 7 ) 8 9 // ChunkReader is an interface to decouple github.com/jackc/chunkreader from this package. 10 type ChunkReader interface { 11 // Next returns buf filled with the next n bytes. If an error (including a partial read) occurs, 12 // buf must be nil. Next must preserve any partially read data. Next must not reuse buf. 13 Next(n int) (buf []byte, err error) 14 } 15 16 // NewChunkReader creates and returns a new default ChunkReader. 17 func NewChunkReader(r io.Reader) ChunkReader { 18 return chunkreader.New(r) 19 }