Documentation ¶
Index ¶
- func AbortTransaction(session mongo.Session) error
- func Client() *mongo.Client
- func Close(ctx context.Context) error
- func CommitTransaction(session mongo.Session) 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
- func Session() mongo.Session
- func SessionContext(ctx context.Context, session mongo.Session) context.Context
- func StartTransaction(session mongo.Session) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbortTransaction ¶
func CommitTransaction ¶
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.
func SessionContext ¶
func StartTransaction ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.