Skip to content

Commit 2036071

Browse files
GODRIVER-3374 Add ReadCompressedCompressedMessage back to wiremessage API (#1870)
Co-authored-by: Matt Dale <[email protected]>
1 parent 6952473 commit 2036071

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

x/mongo/driver/wiremessage/wiremessage.go

+11
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,17 @@ func ReadCompressedCompressorID(src []byte) (id CompressorID, rem []byte, ok boo
539539
return CompressorID(src[0]), src[1:], true
540540
}
541541

542+
// ReadCompressedCompressedMessage reads the compressed wiremessage to dst.
543+
//
544+
// Deprecated: This function is not required by the Go Driver and will be
545+
// removed in the 2.0 release.
546+
func ReadCompressedCompressedMessage(src []byte, length int32) (msg []byte, rem []byte, ok bool) {
547+
if len(src) < int(length) || length < 0 {
548+
return nil, src, false
549+
}
550+
return src[:length], src[length:], true
551+
}
552+
542553
// ReadKillCursorsZero reads the zero field from src.
543554
func ReadKillCursorsZero(src []byte) (zero int32, rem []byte, ok bool) {
544555
return readi32(src)

0 commit comments

Comments
 (0)