parser

package
v0.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 16, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

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

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

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

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

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

Functions

This section is empty.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL