option

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConflictingArgsErrorFormat

func ConflictingArgsErrorFormat(optionName, uriValue, cliValue, cliOptionName string) error

Types

type Auth

type Auth struct {
	Username        string
	Password        string
	Source          string
	Mechanism       string
	AWSSessionToken string
}

Auth Struct holding auth-related options

func (*Auth) IsSet

func (auth *Auth) IsSet() bool

func (*Auth) RequiresExternalDB

func (auth *Auth) RequiresExternalDB() bool

func (*Auth) ShouldAskForPassword

func (auth *Auth) ShouldAskForPassword() bool

ShouldAskForPassword returns true if the user specifies a username flag but no password, and the authentication mechanism requires a password.

type Connection

type Connection struct {
	Host string
	Port string

	Timeout                int
	SocketTimeout          int
	TCPKeepAliveSeconds    int
	ServerSelectionTimeout int
	Compressors            string
}

Connection Struct holding connection-related options

type General

type General struct {
	Failpoints string
	Trace      bool
}

General Struct holding generic options

type Kerberos

type Kerberos struct {
	Service     string
	ServiceHost string
}

Kerberos Struct for Kerberos/GSSAPI-specific options

type Namespace

type Namespace struct {
	// Specified database and collection
	DB         string `short:"d" long:"db" value-name:"<database-name>" description:"database to use"`
	Collection string `short:"c" long:"collection" value-name:"<collection-name>" description:"collection to use"`
}

func (Namespace) String

func (ns Namespace) String() string

type Options

type Options struct {
	*URI
	*General
	*Connection
	*SSL
	*Auth
	*Kerberos
	*Namespace
	// Force direct connection to the server and disable the
	// drivers automatic repl set discovery logic.
	Direct bool

	// ReplicaSetName, if specified, will prevent the obtained session from
	// communicating with any server which is not part of a replica set
	// with the given name. The default is to communicate with any server
	// specified or discovered via the servers contacted.
	ReplicaSetName string

	// ReadPreference, if specified, sets the client default
	ReadPreference *readpref.ReadPref

	// WriteConcern, if specified, sets the client default
	WriteConcern *writeconcern.WriteConcern

	// RetryWrites, if specified, sets the client default.
	RetryWrites *bool

	// Query options
	QueryOptions
}

func (*Options) GetAuthenticationDatabase

func (opts *Options) GetAuthenticationDatabase() string

GetAuthenticationDatabase Get the authentication database to use. Should be the value of --authenticationDatabase if it's provided, otherwise, the database that's specified in the tool's --db arg.

func (*Options) NormalizeOptionsAndURI

func (opts *Options) NormalizeOptionsAndURI() error

NormalizeOptionsAndURI syncs the connection string and toolOptions objects. It returns an error if there is any conflict between options and the connection string. If a value is set on the options, but not the connection string, that value is added to the connection string. If a value is set on the connection string, but not the options, that value is added to the options.

type QueryOptions

type QueryOptions struct {
	Query          string
	QueryFile      string
	SlaveOk        bool
	ReadPreference string
	ForceTableScan bool
	Skip           int64
	Limit          int64
	Sort           string
	AssertExists   bool
}

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

type SSL

type SSL struct {
	UseSSL              bool
	SSLCAFile           string
	SSLPEMKeyFile       string
	SSLPEMKeyPassword   string
	SSLCRLFile          string
	SSLAllowInvalidCert bool
	SSLAllowInvalidHost bool
	SSLFipsMode         bool
	TLSInsecure         bool
}

SSL Struct holding ssl-related options

func (*SSL) ShouldAskForPassword

func (ssl *SSL) ShouldAskForPassword() (bool, error)

ShouldAskForPassword returns true if the user specifies a ssl pem key file flag but no password for that file, and the key file has any encrypted blocks.

type URI

type URI struct {
	ConnectionString string
	ConnString       connstring.ConnString
}

func NewURI

func NewURI(unparsed string) (*URI, error)

func (*URI) GetConnectionAddrs

func (uri *URI) GetConnectionAddrs() []string

func (*URI) ParsedConnString

func (uri *URI) ParsedConnString() *connstring.ConnString

type WriteConcern

type WriteConcern struct {
	// 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
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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