Documentation ¶
Index ¶
Constants ¶
const ( SchemeMongoDB = "mongodb" SchemeMongoDBSRV = "mongodb+srv" )
Scheme constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnString ¶
type ConnString struct { Original string AppName string AuthMechanism string AuthMechanismProperties map[string]string AuthMechanismPropertiesSet bool AuthSource string AuthSourceSet bool Compressors []string Connect ConnectMode ConnectSet bool DirectConnection bool DirectConnectionSet bool ConnectTimeout time.Duration ConnectTimeoutSet bool Database string HeartbeatInterval time.Duration HeartbeatIntervalSet bool Hosts []string J bool JSet bool LocalThreshold time.Duration LocalThresholdSet bool MaxConnIdleTime time.Duration MaxConnIdleTimeSet bool MaxPoolSize uint64 MaxPoolSizeSet bool MinPoolSize uint64 MinPoolSizeSet bool Password string PasswordSet bool ReadConcernLevel string ReadPreference string ReadPreferenceTagSets []map[string]string RetryWrites bool RetryWritesSet bool RetryReads bool RetryReadsSet bool MaxStaleness time.Duration MaxStalenessSet bool ReplicaSet string Scheme string ServerSelectionTimeout time.Duration ServerSelectionTimeoutSet bool SocketTimeout time.Duration SocketTimeoutSet bool SSL bool SSLSet bool SSLClientCertificateKeyFile string SSLClientCertificateKeyFileSet bool SSLClientCertificateKeyPassword func() string SSLClientCertificateKeyPasswordSet bool SSLCertificateFile string SSLCertificateFileSet bool SSLPrivateKeyFile string SSLPrivateKeyFileSet bool SSLInsecure bool SSLInsecureSet bool SSLCaFile string SSLCaFileSet bool SSLDisableOCSPEndpointCheck bool SSLDisableOCSPEndpointCheckSet bool WString string WNumber int WNumberSet bool Username string UsernameSet bool ZlibLevel int ZlibLevelSet bool ZstdLevel int ZstdLevelSet bool WTimeout time.Duration WTimeoutSet bool WTimeoutSetFromOption bool Options map[string][]string UnknownOptions map[string][]string }
ConnString represents a connection string to mongodb.
func Parse ¶
func Parse(s string) (ConnString, error)
Parse parses the provided URI into a ConnString object but does not check that all values are valid. Use `ConnString.Validate()` to run the validation checks separately.
func ParseAndValidate ¶ added in v1.4.0
func ParseAndValidate(s string) (ConnString, error)
ParseAndValidate parses the provided URI into a ConnString object. It check that all values are valid.
func (*ConnString) HasAuthParameters ¶ added in v1.4.0
func (u *ConnString) HasAuthParameters() bool
HasAuthParameters returns true if this ConnString has any authentication parameters set and therefore represents a request for authentication.
func (*ConnString) String ¶
func (u *ConnString) String() string
func (*ConnString) Validate ¶ added in v1.4.0
func (u *ConnString) Validate() error
Validate checks that the Auth and SSL parameters are valid values.
type ConnectMode ¶
type ConnectMode uint8
ConnectMode informs the driver on how to connect to the server.
const ( AutoConnect ConnectMode = iota SingleConnect )
ConnectMode constants.
func (ConnectMode) String ¶ added in v1.4.0
func (c ConnectMode) String() string
String implements the fmt.Stringer interface.