Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-3025

Create a peeking methodology for bson.Decode

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Unknown Unknown
    • None
    • None
    • None
    • None

    Description

      The Go Driver is missing the dec.peek() analogue that encoding/json has, which can be efficiently used to determine if there is more data in the stack: https://cs.opensource.google/go/go/+/refs/tags/go1.21.3:src/encoding/json/stream.go;l=482

      This functionality is extremely useful. Rather than checking the length of a buffer or relying on catching the io.EOF error a user can exhaust the stack iteratively:

      for dec.More() {
        // Do stuff
      } 

      Attachments

        Activity

          People

            Unassigned Unassigned
            preston.vasquez@mongodb.com Preston Vasquez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: