shared

package
v0.11.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCallerLocation added in v0.8.0

func GetCallerLocation() string

GetCallerLocation gets location of the caller in the source code (e.g. "oplog_status.go:91").

func LoadCaFrom added in v0.2.0

func LoadCaFrom(pemFile string) (*x509.CertPool, error)

func LoadKeyPairFrom added in v0.2.0

func LoadKeyPairFrom(pemFile string, privateKeyPemFile string) (tls.Certificate, error)

func MongoClient added in v0.8.0

func MongoClient(opts *MongoSessionOpts) *mongo.Client

MongoClient connects to MongoDB and returns ready to use MongoDB client.

func MongoServerVersionLessThan added in v0.11.0

func MongoServerVersionLessThan(version string, client *mongo.Client) bool

func MongoSessionNodeType

func MongoSessionNodeType(client *mongo.Client) (string, error)

MongoSessionNodeType returns mongo node type.

func MongoSessionServerVersion

func MongoSessionServerVersion(client *mongo.Client) (string, error)

MongoSessionServerVersion returns mongo server version.

func RedactMongoUri added in v0.2.0

func RedactMongoUri(uri string) string

RedactMongoUri removes login and password from mongoUri.

func TestConnection added in v0.6.0

func TestConnection(opts MongoSessionOpts) ([]byte, error)

TestConnection connects to MongoDB and returns BuildInfo.

Types

type BuildInfo added in v0.8.0

type BuildInfo struct {
	Version        string
	VersionArray   []int  `bson:"versionArray"` // On MongoDB 2.0+; assembled from Version otherwise
	GitVersion     string `bson:"gitVersion"`
	OpenSSLVersion string `bson:"OpenSSLVersion"`
	SysInfo        string `bson:"sysInfo"` // Deprecated and empty on MongoDB 3.2+.
	Bits           int
	Debug          bool
	MaxObjectSize  int `bson:"maxBsonObjectSize"`
}

BuildInfo represents mongodb build info.

func GetBuildInfo added in v0.8.0

func GetBuildInfo(client *mongo.Client) (info BuildInfo, err error)

GetBuildInfo gets mongo build info.

type MongoSessionOpts added in v0.2.0

type MongoSessionOpts struct {
	URI string
}

type SyncStringSet added in v0.11.0

type SyncStringSet struct {
	// contains filtered or unexported fields
}

String set synchronized with sync.RWMutex

func NewSyncStringSet added in v0.11.0

func NewSyncStringSet() *SyncStringSet

NewSyncStringSet returns new SyncStringSet

func (*SyncStringSet) Add added in v0.11.0

func (l *SyncStringSet) Add(s string)

Add the value to the set.

func (*SyncStringSet) Contains added in v0.11.0

func (l *SyncStringSet) Contains(s string) bool

Contains check whether set contains the value

func (*SyncStringSet) Delete added in v0.11.0

func (l *SyncStringSet) Delete(s string)

Delete value from the set

func (*SyncStringSet) GetAll added in v0.11.0

func (l *SyncStringSet) GetAll() []string

GetAll returns slice of all values stored in the set

Jump to

Keyboard shortcuts

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