Documentation ¶
Index ¶
- Variables
- type Parser
- func (p *Parser) ParseBinary() (*ast.Binary, error)
- func (p *Parser) ParseCString() (string, error)
- func (p *Parser) ParseCodeWithScope() (*ast.CodeWithScope, error)
- func (p *Parser) ParseDocument() (*ast.Document, error)
- func (p *Parser) ParseDouble() (float64, error)
- func (p *Parser) ParseEList() ([]ast.Element, error)
- func (p *Parser) ParseEName() (*ast.ElementKeyName, error)
- func (p *Parser) ParseElement() (ast.Element, error)
- func (p *Parser) ParseString() (string, error)
- func (p *Parser) ParseSubtype() (ast.BinarySubtype, error)
Constants ¶
This section is empty.
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.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser is a BSON parser.
func NewBSONParser ¶
NewBSONParser instantiates a new BSON Parser with the given reader.
func (*Parser) ParseBinary ¶
ParseBinary parses a binary node from the parser's reader.
func (*Parser) ParseCString ¶
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 ¶
ParseDocument parses an entire document from the parser's reader.
func (*Parser) ParseDouble ¶
ParseDouble parses a float64 from the parser's reader.
TODO(skriptble): This should be a read* method.
func (*Parser) ParseEList ¶
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 ¶
ParseElement parses an element from the parser's reader.
func (*Parser) ParseString ¶
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.