Documentation ¶
Index ¶
- func Client() *mongo.Client
- func Close(ctx context.Context) error
- func Database(name string) *mongo.Database
- func ExtractDatabaseName(uri string) (dbName, extractedURI string, err error)
- func Init(ctx context.Context, uri string)
- func InitWithOption(ctx context.Context, opt *options.ClientOptions)
- func Ping(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractDatabaseName ¶
ExtractDatabaseName extracts database name from uri if exists, and returns it together with the extracted uri (without database name) ref: https://docs.mongodb.com/manual/reference/connection-string/
func Init ¶
Init is a singleton, it will be initialized only once. In case the uri provides only a single host in the mongodb cluster, the system will attempt to connect without discovering other hosts in the cluster.
func InitWithOption ¶
func InitWithOption(ctx context.Context, opt *options.ClientOptions)
InitWithOption is a singleton, it will be initialized only once.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.