Documentation ¶
Overview ¶
Package mongo is a generated GoMock package.
Package mongo is a generated GoMock package.
Index ¶
- type Client
- func (c *Client) Connect()
- func (c *Client) CountDocuments(ctx context.Context, collection string, filter interface{}) (int64, error)
- func (c *Client) CreateCollection(ctx context.Context, name string) error
- func (c *Client) DeleteMany(ctx context.Context, collection string, filter interface{}) (int64, error)
- func (c *Client) DeleteOne(ctx context.Context, collection string, filter interface{}) (int64, error)
- func (c *Client) Drop(ctx context.Context, collection string) error
- func (c *Client) Find(ctx context.Context, collection string, filter, results interface{}) error
- func (c *Client) FindOne(ctx context.Context, collection string, filter, result interface{}) error
- func (c *Client) HealthCheck(ctx context.Context) (any, error)
- func (c *Client) InsertMany(ctx context.Context, collection string, documents []interface{}) ([]interface{}, error)
- func (c *Client) InsertOne(ctx context.Context, collection string, document interface{}) (interface{}, error)
- func (c *Client) StartSession() (interface{}, error)
- func (c *Client) UpdateByID(ctx context.Context, collection string, id, update interface{}) (int64, error)
- func (c *Client) UpdateMany(ctx context.Context, collection string, filter, update interface{}) (int64, error)
- func (c *Client) UpdateOne(ctx context.Context, collection string, filter, update interface{}) error
- func (c *Client) UseLogger(logger interface{})
- func (c *Client) UseMetrics(metrics interface{})
- func (c *Client) UseTracer(tracer any)
- type Config
- type Health
- type Logger
- type Metrics
- type MockLogger
- type MockLoggerMockRecorder
- func (mr *MockLoggerMockRecorder) Debug(args ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Debugf(pattern any, args ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Errorf(pattern any, args ...any) *gomock.Call
- func (mr *MockLoggerMockRecorder) Logf(pattern any, args ...any) *gomock.Call
- type MockMetrics
- type MockMetricsMockRecorder
- type QueryLog
- type Transaction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func (*Client) Connect ¶
func (c *Client) Connect()
Connect establishes a connection to MongoDB and registers metrics using the provided configuration when the client was Created.
func (*Client) CountDocuments ¶
func (c *Client) CountDocuments(ctx context.Context, collection string, filter interface{}) (int64, error)
CountDocuments counts the number of documents in the specified collection based on the provided filter.
func (*Client) CreateCollection ¶
CreateCollection creates the specified collection in the database.
func (*Client) DeleteMany ¶
func (c *Client) DeleteMany(ctx context.Context, collection string, filter interface{}) (int64, error)
DeleteMany deletes multiple documents from the specified collection based on the provided filter.
func (*Client) DeleteOne ¶
func (c *Client) DeleteOne(ctx context.Context, collection string, filter interface{}) (int64, error)
DeleteOne deletes a single document from the specified collection based on the provided filter.
func (*Client) Find ¶
Find retrieves documents from the specified collection based on the provided filter and binds response to result.
func (*Client) FindOne ¶
FindOne retrieves a single document from the specified collection based on the provided filter and binds response to result.
func (*Client) HealthCheck ¶
HealthCheck checks the health of the MongoDB client by pinging the database.
func (*Client) InsertMany ¶
func (c *Client) InsertMany(ctx context.Context, collection string, documents []interface{}) ([]interface{}, error)
InsertMany inserts multiple documents into the specified collection.
func (*Client) InsertOne ¶
func (c *Client) InsertOne(ctx context.Context, collection string, document interface{}) (interface{}, error)
InsertOne inserts a single document into the specified collection.
func (*Client) StartSession ¶
func (*Client) UpdateByID ¶
func (c *Client) UpdateByID(ctx context.Context, collection string, id, update interface{}) (int64, error)
UpdateByID updates a document in the specified collection by its ID.
func (*Client) UpdateMany ¶
func (c *Client) UpdateMany(ctx context.Context, collection string, filter, update interface{}) (int64, error)
UpdateMany updates multiple documents in the specified collection based on the provided filter.
func (*Client) UpdateOne ¶
func (c *Client) UpdateOne(ctx context.Context, collection string, filter, update interface{}) error
UpdateOne updates a single document in the specified collection based on the provided filter.
func (*Client) UseLogger ¶
func (c *Client) UseLogger(logger interface{})
UseLogger sets the logger for the MongoDB client which asserts the Logger interface.
func (*Client) UseMetrics ¶
func (c *Client) UseMetrics(metrics interface{})
UseMetrics sets the metrics for the MongoDB client which asserts the Metrics interface.
type MockLogger ¶
type MockLogger struct {
// contains filtered or unexported fields
}
MockLogger is a mock of Logger interface.
func NewMockLogger ¶
func NewMockLogger(ctrl *gomock.Controller) *MockLogger
NewMockLogger creates a new mock instance.
func (*MockLogger) Debugf ¶ added in v0.3.0
func (m *MockLogger) Debugf(pattern string, args ...any)
Debugf mocks base method.
func (*MockLogger) EXPECT ¶
func (m *MockLogger) EXPECT() *MockLoggerMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockLogger) Errorf ¶
func (m *MockLogger) Errorf(pattern string, args ...any)
Errorf mocks base method.
func (*MockLogger) Logf ¶
func (m *MockLogger) Logf(pattern string, args ...any)
Logf mocks base method.
type MockLoggerMockRecorder ¶
type MockLoggerMockRecorder struct {
// contains filtered or unexported fields
}
MockLoggerMockRecorder is the mock recorder for MockLogger.
func (*MockLoggerMockRecorder) Debug ¶
func (mr *MockLoggerMockRecorder) Debug(args ...any) *gomock.Call
Debug indicates an expected call of Debug.
func (*MockLoggerMockRecorder) Debugf ¶ added in v0.3.0
func (mr *MockLoggerMockRecorder) Debugf(pattern any, args ...any) *gomock.Call
Debugf indicates an expected call of Debugf.
type MockMetrics ¶
type MockMetrics struct {
// contains filtered or unexported fields
}
MockMetrics is a mock of Metrics interface.
func NewMockMetrics ¶
func NewMockMetrics(ctrl *gomock.Controller) *MockMetrics
NewMockMetrics creates a new mock instance.
func (*MockMetrics) EXPECT ¶
func (m *MockMetrics) EXPECT() *MockMetricsMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockMetrics) NewHistogram ¶
func (m *MockMetrics) NewHistogram(name, desc string, buckets ...float64)
NewHistogram mocks base method.
func (*MockMetrics) RecordHistogram ¶
func (m *MockMetrics) RecordHistogram(ctx context.Context, name string, value float64, labels ...string)
RecordHistogram mocks base method.
type MockMetricsMockRecorder ¶
type MockMetricsMockRecorder struct {
// contains filtered or unexported fields
}
MockMetricsMockRecorder is the mock recorder for MockMetrics.
func (*MockMetricsMockRecorder) NewHistogram ¶
func (mr *MockMetricsMockRecorder) NewHistogram(name, desc any, buckets ...any) *gomock.Call
NewHistogram indicates an expected call of NewHistogram.
func (*MockMetricsMockRecorder) RecordHistogram ¶
func (mr *MockMetricsMockRecorder) RecordHistogram(ctx, name, value any, labels ...any) *gomock.Call
RecordHistogram indicates an expected call of RecordHistogram.
type QueryLog ¶
type QueryLog struct { Query string `json:"query"` Duration int64 `json:"duration"` Collection string `json:"collection,omitempty"` Filter interface{} `json:"filter,omitempty"` ID interface{} `json:"id,omitempty"` Update interface{} `json:"update,omitempty"` }