Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance Mongo Driver #779

Merged
merged 14 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pkg/gofr/container/datasources.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,19 @@ type Mongo interface {
// Drop an entire collection from the database.
// It returns an error if any.
Drop(ctx context.Context, collection string) error

// CreateCollection creates a new collection with specified name and default options.
CreateCollection(ctx context.Context, name string) error

// StartSession starts a session and provide methods to run commands in a transaction.
StartSession() (interface{}, error)
}

type Transaction interface {
StartTransaction() error
AbortTransaction(context.Context) error
CommitTransaction(context.Context) error
EndSession(context.Context)
}

// MongoProvider is an interface that extends Mongo with additional methods for logging, metrics, and connection management.
Expand Down
Loading
Loading