package parser

import "go.mongodb.org/mongo-driver/bson/parser"

Index

Variables

var ErrCorruptDocument = errors.New("bson/parser: corrupted document")

ErrCorruptDocument is returned when the parser reaches a corrupt point within a BSON document.

var ErrNilReader = errors.New("bson/parser: nil or invalid reader provided")

ErrNilReader is returned when a nil reader is passed to NewBSONParser.

var ErrUnknownSubtype = errors.New("bson/parser: unknown binary subtype")

ErrUnknownSubtype is returned when the subtype of a binary node is undefined.

Types

type Parser

type Parser struct {
	// contains filtered or unexported fields
}

Parser is a BSON parser.

func NewBSONParser

func NewBSONParser(r io.Reader) (*Parser, error)

NewBSONParser instantiates a new BSON Parser with the given reader.

func (*Parser) ParseBinary

func (p *Parser) ParseBinary() (*ast.Binary, error)

ParseBinary parses a binary node from the parser's reader.

func (*Parser) ParseCString

func (p *Parser) ParseCString() (string, error)

ParseCString parses a c-style string from the parser's reader.

TODO(skriptble): Should this be a read* method since it's returning a Go primitive? That would fit with the rest of the read* methods.

func (*Parser) ParseCodeWithScope

func (p *Parser) ParseCodeWithScope() (*ast.CodeWithScope, error)

ParseCodeWithScope parses a JavaScript Code with Scope node from the parser's reader.

func (*Parser) ParseDocument

func (p *Parser) ParseDocument() (*ast.Document, error)

ParseDocument parses an entire document from the parser's reader.

func (*Parser) ParseDouble

func (p *Parser) ParseDouble() (float64, error)

ParseDouble parses a float64 from the parser's reader.

TODO(skriptble): This should be a read* method.

func (*Parser) ParseEList

func (p *Parser) ParseEList() ([]ast.Element, error)

ParseEList parses an entire element list from the parser's reader.

func (*Parser) ParseEName

func (p *Parser) ParseEName() (*ast.ElementKeyName, error)

ParseEName parses an element's key from the parser's reader.

func (*Parser) ParseElement

func (p *Parser) ParseElement() (ast.Element, error)

ParseElement parses an element from the parser's reader.

func (*Parser) ParseString

func (p *Parser) ParseString() (string, error)

ParseString parses a string from the parser's reader.

TODO(skriptble): Should this be a read* method since it's returning a Go primitive? That would fit with the rest of the read* methods.

func (*Parser) ParseSubtype

func (p *Parser) ParseSubtype() (ast.BinarySubtype, error)

ParseSubtype parses the subtype for a binary node from the parser's reader.

Source Files

parser.go

Directories

PathSynopsis
bson/parser/ast
Version
v0.0.17
Published
Oct 25, 2018
Platform
linux/amd64
Imports
7 packages
Last checked
1 minute ago

Tools for package owners.