Documentation ¶
Overview ¶
Package bsondump converts BSON files into human-readable formats such as JSON.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Usage = `` /* 131-byte string literal not displayed */
Functions ¶
This section is empty.
Types ¶
type BSONDump ¶
type BSONDump struct { // generic mongo tool options ToolOptions *options.ToolOptions // BSONDumpOptions defines options used to control how BSON data is displayed BSONDumpOptions *BSONDumpOptions // File handle for the output data. Out io.WriteCloser BSONSource *db.BSONSource }
BSONDump is a container for the user-specified options and internal state used for running bsondump.
func (*BSONDump) Debug ¶
Debug iterates through the BSON file and for each document it finds, recursively descends into objects and arrays and prints a human readable BSON representation containing the type and size of each field. It returns the number of documents processed and a non-nil error if one is encountered before the end of the file is reached.
func (*BSONDump) JSON ¶
JSON iterates through the BSON file and for each document it finds, recursively descends into objects and arrays and prints the human readable JSON representation. It returns the number of documents processed and a non-nil error if one is encountered before the end of the file is reached.
type BSONDumpOptions ¶
type BSONDumpOptions struct { // Format to display the BSON data file Type string `long:"type" value-name:"<type>" default:"json" default-mask:"-" description:"type of output: debug, json (default 'json')"` // Validate each BSON document before displaying ObjCheck bool `long:"objcheck" description:"validate BSON during processing"` // Display JSON data with indents Pretty bool `long:"pretty" description:"output JSON formatted to be human-readable"` // Path to input BSON file BSONFileName string `long:"bsonFile" description:"path to BSON file to dump to JSON; default is stdin"` // Path to output file OutFileName string `long:"outFile" description:"path to output file to dump BSON to; default is stdout"` }
func (*BSONDumpOptions) GetBSONReader ¶
func (bdo *BSONDumpOptions) GetBSONReader() (io.ReadCloser, error)
GetBSONReader opens and returns an io.ReadCloser for the BSONFileName in BSONDumpOptions or nil if none is set. The caller is responsible for closing it.
func (*BSONDumpOptions) GetWriter ¶
func (bdo *BSONDumpOptions) GetWriter() (io.WriteCloser, error)
GetWriter opens and returns an io.WriteCloser for the OutFileName in BSONDumpOptions or nil if none is set. The caller is responsible for closing it.
func (*BSONDumpOptions) Name ¶
func (_ *BSONDumpOptions) Name() string
func (*BSONDumpOptions) PostParse ¶
func (_ *BSONDumpOptions) PostParse() error
func (*BSONDumpOptions) Validate ¶
func (_ *BSONDumpOptions) Validate() error
type ReadNopCloser ¶
func (ReadNopCloser) Close ¶
func (ReadNopCloser) Close() error
type WriteNopCloser ¶
func (WriteNopCloser) Close ¶
func (WriteNopCloser) Close() error