Documentation
¶
Index ¶
- type MongoDBAdapter
- func (m *MongoDBAdapter) Aggregate(ctx context.Context, collection string, pipeline []map[string]interface{}) ([]map[string]interface{}, error)
- func (m *MongoDBAdapter) Close() error
- func (m *MongoDBAdapter) CollectionExists(ctx context.Context, name string) (bool, error)
- func (m *MongoDBAdapter) Connect(config *documents.DocDBConfig) error
- func (m *MongoDBAdapter) CountDocuments(ctx context.Context, collection string, filter interface{}) (int64, error)
- func (m *MongoDBAdapter) CreateCollection(ctx context.Context, name string) error
- func (m *MongoDBAdapter) CreateIndex(ctx context.Context, collection string, keys map[string]int, ...) error
- func (m *MongoDBAdapter) DeleteMany(ctx context.Context, collection string, filter interface{}) (int64, error)
- func (m *MongoDBAdapter) DeleteOne(ctx context.Context, collection string, filter interface{}) error
- func (m *MongoDBAdapter) DropCollection(ctx context.Context, name string) error
- func (m *MongoDBAdapter) DropIndex(ctx context.Context, collection string, name string) error
- func (m *MongoDBAdapter) FindMany(ctx context.Context, collection string, filter interface{}, ...) ([]map[string]interface{}, error)
- func (m *MongoDBAdapter) FindOne(ctx context.Context, collection string, filter interface{}) (map[string]interface{}, error)
- func (m *MongoDBAdapter) GetType() documents.DocDBType
- func (m *MongoDBAdapter) InsertMany(ctx context.Context, collection string, docs []interface{}) ([]string, error)
- func (m *MongoDBAdapter) InsertOne(ctx context.Context, collection string, document interface{}) (string, error)
- func (m *MongoDBAdapter) IsConnected() bool
- func (m *MongoDBAdapter) ListCollections(ctx context.Context) ([]string, error)
- func (m *MongoDBAdapter) ListIndexes(ctx context.Context, collection string) ([]documents.IndexInfo, error)
- func (m *MongoDBAdapter) Ping(ctx context.Context) error
- func (m *MongoDBAdapter) Stats(ctx context.Context) (*documents.DBStats, error)
- func (m *MongoDBAdapter) UpdateMany(ctx context.Context, collection string, filter interface{}, update interface{}) (int64, error)
- func (m *MongoDBAdapter) UpdateOne(ctx context.Context, collection string, filter interface{}, update interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MongoDBAdapter ¶
type MongoDBAdapter struct {
// contains filtered or unexported fields
}
MongoDBAdapter implements the DocumentDB interface for MongoDB
func NewMongoDBAdapter ¶
func NewMongoDBAdapter(config *documents.DocDBConfig) *MongoDBAdapter
NewMongoDBAdapter creates a new MongoDB adapter
func (*MongoDBAdapter) Aggregate ¶
func (m *MongoDBAdapter) Aggregate(ctx context.Context, collection string, pipeline []map[string]interface{}) ([]map[string]interface{}, error)
Aggregate performs an aggregation operation
func (*MongoDBAdapter) Close ¶
func (m *MongoDBAdapter) Close() error
Close closes the MongoDB connection
func (*MongoDBAdapter) CollectionExists ¶
CollectionExists checks if a collection exists
func (*MongoDBAdapter) Connect ¶
func (m *MongoDBAdapter) Connect(config *documents.DocDBConfig) error
Connect establishes connection to MongoDB
func (*MongoDBAdapter) CountDocuments ¶
func (m *MongoDBAdapter) CountDocuments(ctx context.Context, collection string, filter interface{}) (int64, error)
CountDocuments counts documents matching the filter
func (*MongoDBAdapter) CreateCollection ¶
func (m *MongoDBAdapter) CreateCollection(ctx context.Context, name string) error
CreateCollection creates a new collection
func (*MongoDBAdapter) CreateIndex ¶
func (m *MongoDBAdapter) CreateIndex(ctx context.Context, collection string, keys map[string]int, opts *documents.IndexOptions) error
CreateIndex creates an index on a collection
func (*MongoDBAdapter) DeleteMany ¶
func (m *MongoDBAdapter) DeleteMany(ctx context.Context, collection string, filter interface{}) (int64, error)
DeleteMany deletes multiple documents
func (*MongoDBAdapter) DeleteOne ¶
func (m *MongoDBAdapter) DeleteOne(ctx context.Context, collection string, filter interface{}) error
DeleteOne deletes a single document
func (*MongoDBAdapter) DropCollection ¶
func (m *MongoDBAdapter) DropCollection(ctx context.Context, name string) error
DropCollection drops a collection
func (*MongoDBAdapter) FindMany ¶
func (m *MongoDBAdapter) FindMany(ctx context.Context, collection string, filter interface{}, opts *documents.FindOptions) ([]map[string]interface{}, error)
FindMany finds multiple documents
func (*MongoDBAdapter) FindOne ¶
func (m *MongoDBAdapter) FindOne(ctx context.Context, collection string, filter interface{}) (map[string]interface{}, error)
FindOne finds a single document
func (*MongoDBAdapter) GetType ¶
func (m *MongoDBAdapter) GetType() documents.DocDBType
GetType returns the database type
func (*MongoDBAdapter) InsertMany ¶
func (m *MongoDBAdapter) InsertMany(ctx context.Context, collection string, docs []interface{}) ([]string, error)
InsertMany inserts multiple documents
func (*MongoDBAdapter) InsertOne ¶
func (m *MongoDBAdapter) InsertOne(ctx context.Context, collection string, document interface{}) (string, error)
InsertOne inserts a single document
func (*MongoDBAdapter) IsConnected ¶
func (m *MongoDBAdapter) IsConnected() bool
IsConnected checks if the adapter is connected
func (*MongoDBAdapter) ListCollections ¶
func (m *MongoDBAdapter) ListCollections(ctx context.Context) ([]string, error)
ListCollections lists all collections in the database
func (*MongoDBAdapter) ListIndexes ¶
func (m *MongoDBAdapter) ListIndexes(ctx context.Context, collection string) ([]documents.IndexInfo, error)
ListIndexes lists all indexes on a collection
func (*MongoDBAdapter) Ping ¶
func (m *MongoDBAdapter) Ping(ctx context.Context) error
Ping checks the connection to MongoDB
func (*MongoDBAdapter) UpdateMany ¶
func (m *MongoDBAdapter) UpdateMany(ctx context.Context, collection string, filter interface{}, update interface{}) (int64, error)
UpdateMany updates multiple documents