mongofiles

package
v0.0.0-...-462fb9d Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package mongofiles provides an interface to GridFS collections in a MongoDB instance.

Index

Constants

View Source
const (
	List     = "list"
	Search   = "search"
	Put      = "put"
	Get      = "get"
	GetID    = "get_id"
	Delete   = "delete"
	DeleteID = "delete_id"
)

List of possible commands for mongofiles.

Variables

View Source
var Usage = `` /* 642-byte string literal not displayed */

Functions

This section is empty.

Types

type GFSFile

type GFSFile struct {
	Id          bson.ObjectId `bson:"_id"`
	ChunkSize   int           `bson:"chunkSize"`
	Name        string        `bson:"filename"`
	Length      int64         `bson:"length"`
	Md5         string        `bson:"md5"`
	UploadDate  time.Time     `bson:"uploadDate"`
	ContentType string        `bson:"contentType,omitempty"`
}

GFSFile represents a GridFS file.

type InputOptions

type InputOptions struct {
	ReadPreference string `long:"readPreference" value-name:"<string>|<json>" description:"specify either a preference name or a preference json object"`
}

InputOptions defines the set of options to use in retrieving data from the server.

func (*InputOptions) Name

func (*InputOptions) Name() string

Name returns a human-readable group name for input options.

type MongoFiles

type MongoFiles struct {
	// generic mongo tool options
	ToolOptions *options.ToolOptions

	// mongofiles-specific storage options
	StorageOptions *StorageOptions

	// mongofiles-specific input options
	InputOptions *InputOptions

	// for connecting to the db
	SessionProvider *db.SessionProvider

	// command to run
	Command string

	// filename in GridFS
	FileName string
}

MongoFiles is a container for the user-specified options and internal state used for running mongofiles.

func (*MongoFiles) Run

func (mf *MongoFiles) Run(displayHost bool) (string, error)

Run the mongofiles utility. If displayHost is true, the connected host/port is displayed.

func (*MongoFiles) ValidateCommand

func (mf *MongoFiles) ValidateCommand(args []string) error

ValidateCommand ensures the arguments supplied are valid.

type StorageOptions

type StorageOptions struct {
	// Specified database to use. defaults to 'test' if none is specified
	DB string `` /* 130-byte string literal not displayed */

	// 'LocalFileName' is an option that specifies what filename to use for (put|get)
	LocalFileName string `long:"local" value-name:"<filename>" short:"l" description:"local filename for put|get"`

	// 'ContentType' is an option that specifies the Content/MIME type to use for 'put'
	ContentType string `long:"type" value-nane:"<content-type>" short:"t" description:"content/MIME type for put (optional)"`

	// if set, 'Replace' will remove other files with same name after 'put'
	Replace bool `long:"replace" short:"r" description:"remove other files with same name after put"`

	// GridFSPrefix specifies what GridFS prefix to use; defaults to 'fs'
	GridFSPrefix string `long:"prefix" value-name:"<prefix>" default:"fs" default-mask:"-" description:"GridFS prefix to use (default is 'fs')"`

	// Specifies the write concern for each write operation that mongofiles writes to the target database.
	// By default, mongofiles waits for a majority of members from the replica set to respond before returning.
	WriteConcern string `` /* 236-byte string literal not displayed */
}

StorageOptions defines the set of options to use in storing/retrieving data from server.

func (*StorageOptions) Name

func (_ *StorageOptions) Name() string

Name returns a human-readable group name for storage options.

Directories

Path Synopsis
Main package for the mongofiles tool.
Main package for the mongofiles tool.

Jump to

Keyboard shortcuts

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