Documentation
¶
Index ¶
- type Client
- func (c *Client) Collection(name string) *mongo.Collection
- func (c *Client) Database() *mongo.Database
- func (c *Client) Disconnect(ctx context.Context) error
- func (c *Client) IsHealthy(ctx context.Context) bool
- func (c *Client) Ping(ctx context.Context) error
- func (c *Client) WithTransaction(ctx context.Context, fn func(mongo.SessionContext) error) error
- type MongoConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client wraps mongo.Client and provides additional functionality
func Connect ¶
func Connect(cfg MongoConfig) (*Client, error)
func (*Client) Collection ¶
func (c *Client) Collection(name string) *mongo.Collection
Collection returns a handle to a collection in the configured database
func (*Client) Disconnect ¶
Disconnect closes the MongoDB connection
func (*Client) WithTransaction ¶
WithTransaction executes a function within a MongoDB transaction
type MongoConfig ¶
Click to show internal directories.
Click to hide internal directories.