Documentation
¶
Index ¶
- type CollectionHandler
- func (c *CollectionHandler) Aggregate(pipeline []map[string]interface{}) ([]map[string]interface{}, error)
- func (c *CollectionHandler) CountDocuments(filter map[string]interface{}) (int64, error)
- func (c *CollectionHandler) CreateIndex(keys map[string]interface{}, unique bool) (string, error)
- func (c *CollectionHandler) DeleteMany(filter map[string]interface{}) (int64, error)
- func (c *CollectionHandler) DeleteOne(filter map[string]interface{}) (int64, error)
- func (c *CollectionHandler) DropIndex(name string) error
- func (c *CollectionHandler) Find(filter map[string]interface{}) ([]map[string]interface{}, error)
- func (c *CollectionHandler) FindOne(filter map[string]interface{}) (map[string]interface{}, error)
- func (c *CollectionHandler) InsertMany(docs []map[string]interface{}) ([]interface{}, error)
- func (c *CollectionHandler) InsertOne(doc map[string]interface{}) (interface{}, error)
- func (c *CollectionHandler) UpdateMany(filter map[string]interface{}, update map[string]interface{}) (int64, error)
- func (c *CollectionHandler) UpdateOne(filter map[string]interface{}, update map[string]interface{}) (int64, error)
- type Handler
- type MockCollectionHandler
- func (c *MockCollectionHandler) Aggregate(pipeline []map[string]interface{}) ([]map[string]interface{}, error)
- func (c *MockCollectionHandler) CountDocuments(filter map[string]interface{}) (int64, error)
- func (c *MockCollectionHandler) CreateIndex(keys map[string]interface{}, unique bool) (string, error)
- func (c *MockCollectionHandler) DeleteMany(filter map[string]interface{}) (int64, error)
- func (c *MockCollectionHandler) DeleteOne(filter map[string]interface{}) (int64, error)
- func (c *MockCollectionHandler) DropIndex(name string) error
- func (c *MockCollectionHandler) Find(filter map[string]interface{}) ([]map[string]interface{}, error)
- func (c *MockCollectionHandler) FindOne(filter map[string]interface{}) (map[string]interface{}, error)
- func (c *MockCollectionHandler) InsertMany(docs []map[string]interface{}) ([]interface{}, error)
- func (c *MockCollectionHandler) InsertOne(doc map[string]interface{}) (interface{}, error)
- func (c *MockCollectionHandler) UpdateMany(filter map[string]interface{}, update map[string]interface{}) (int64, error)
- func (c *MockCollectionHandler) UpdateOne(filter map[string]interface{}, update map[string]interface{}) (int64, error)
- type MockHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollectionHandler ¶
type CollectionHandler struct {
// contains filtered or unexported fields
}
CollectionHandler provides operations on a single MongoDB collection.
func (*CollectionHandler) Aggregate ¶
func (c *CollectionHandler) Aggregate(pipeline []map[string]interface{}) ([]map[string]interface{}, error)
Aggregate executes an aggregation pipeline.
func (*CollectionHandler) CountDocuments ¶
func (c *CollectionHandler) CountDocuments(filter map[string]interface{}) (int64, error)
CountDocuments counts documents matching the filter.
func (*CollectionHandler) CreateIndex ¶
func (c *CollectionHandler) CreateIndex(keys map[string]interface{}, unique bool) (string, error)
CreateIndex creates an index on the collection.
func (*CollectionHandler) DeleteMany ¶
func (c *CollectionHandler) DeleteMany(filter map[string]interface{}) (int64, error)
DeleteMany deletes all documents matching the filter.
func (*CollectionHandler) DeleteOne ¶
func (c *CollectionHandler) DeleteOne(filter map[string]interface{}) (int64, error)
DeleteOne deletes the first document matching the filter.
func (*CollectionHandler) DropIndex ¶
func (c *CollectionHandler) DropIndex(name string) error
DropIndex drops an index by name.
func (*CollectionHandler) Find ¶
func (c *CollectionHandler) Find(filter map[string]interface{}) ([]map[string]interface{}, error)
Find returns all documents matching the filter.
func (*CollectionHandler) FindOne ¶
func (c *CollectionHandler) FindOne(filter map[string]interface{}) (map[string]interface{}, error)
FindOne returns the first document matching the filter.
func (*CollectionHandler) InsertMany ¶
func (c *CollectionHandler) InsertMany(docs []map[string]interface{}) ([]interface{}, error)
InsertMany inserts multiple documents and returns the inserted IDs.
func (*CollectionHandler) InsertOne ¶
func (c *CollectionHandler) InsertOne(doc map[string]interface{}) (interface{}, error)
InsertOne inserts a single document and returns the inserted ID.
func (*CollectionHandler) UpdateMany ¶
func (c *CollectionHandler) UpdateMany(filter map[string]interface{}, update map[string]interface{}) (int64, error)
UpdateMany updates all documents matching the filter.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler wraps a MongoDB client and provides database operations for GlyphLang.
func NewHandler ¶
NewHandler creates a Handler from an existing MongoDB client and database name.
func NewHandlerFromURI ¶
NewHandlerFromURI creates a Handler by connecting to the given MongoDB URI.
func (*Handler) Collection ¶
func (h *Handler) Collection(name string) *CollectionHandler
Collection returns a CollectionHandler for the named collection.
type MockCollectionHandler ¶
type MockCollectionHandler struct {
// contains filtered or unexported fields
}
MockCollectionHandler provides in-memory document operations.
func (*MockCollectionHandler) Aggregate ¶
func (c *MockCollectionHandler) Aggregate(pipeline []map[string]interface{}) ([]map[string]interface{}, error)
Aggregate is a simplified mock that returns all documents (real aggregation is not supported in mock).
func (*MockCollectionHandler) CountDocuments ¶
func (c *MockCollectionHandler) CountDocuments(filter map[string]interface{}) (int64, error)
CountDocuments counts matching documents.
func (*MockCollectionHandler) CreateIndex ¶
func (c *MockCollectionHandler) CreateIndex(keys map[string]interface{}, unique bool) (string, error)
CreateIndex is a no-op in the mock. Returns a generated index name.
func (*MockCollectionHandler) DeleteMany ¶
func (c *MockCollectionHandler) DeleteMany(filter map[string]interface{}) (int64, error)
DeleteMany deletes all matching documents.
func (*MockCollectionHandler) DeleteOne ¶
func (c *MockCollectionHandler) DeleteOne(filter map[string]interface{}) (int64, error)
DeleteOne deletes the first matching document.
func (*MockCollectionHandler) DropIndex ¶
func (c *MockCollectionHandler) DropIndex(name string) error
DropIndex is a no-op in the mock.
func (*MockCollectionHandler) Find ¶
func (c *MockCollectionHandler) Find(filter map[string]interface{}) ([]map[string]interface{}, error)
Find returns all documents matching the filter.
func (*MockCollectionHandler) FindOne ¶
func (c *MockCollectionHandler) FindOne(filter map[string]interface{}) (map[string]interface{}, error)
FindOne returns the first document matching the filter.
func (*MockCollectionHandler) InsertMany ¶
func (c *MockCollectionHandler) InsertMany(docs []map[string]interface{}) ([]interface{}, error)
InsertMany inserts multiple documents.
func (*MockCollectionHandler) InsertOne ¶
func (c *MockCollectionHandler) InsertOne(doc map[string]interface{}) (interface{}, error)
InsertOne inserts a single document.
func (*MockCollectionHandler) UpdateMany ¶
func (c *MockCollectionHandler) UpdateMany(filter map[string]interface{}, update map[string]interface{}) (int64, error)
UpdateMany updates all matching documents.
type MockHandler ¶
type MockHandler struct {
// contains filtered or unexported fields
}
MockHandler provides an in-memory MongoDB-like handler for testing.
func (*MockHandler) Collection ¶
func (m *MockHandler) Collection(name string) *MockCollectionHandler
Collection returns a MockCollectionHandler for the named collection.