Documentation ¶
Index ¶
- Variables
- func CurrentClient(registry *container.Registry) *mongo.Client
- func CurrentCollection(cdi *container.Registry) *mongo.Collection
- func CurrentDatabase(registry *container.Registry) *mongo.Database
- func WithCollectionManager(registry *container.Registry, manager interface{}, collectionName string) error
- func WithTraits(registry *container.Registry, traits ...Trait) error
- type Component
- type Manager
- func (m *Manager) Aggregate(pipeline interface{}, opts ...*options.AggregateOptions) (*mongo.Cursor, error)
- func (m *Manager) BulkWrite(models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error)
- func (m *Manager) CountDocuments(filter interface{}, opts ...*options.CountOptions) (int64, error)
- func (m *Manager) DeleteMany(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (m *Manager) DeleteOne(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
- func (m *Manager) Distinct(fieldName string, filter interface{}, opts ...*options.DistinctOptions) ([]interface{}, error)
- func (m *Manager) EnsureIndex(indexName string, keys primitive.D, unique bool, ...) error
- func (m *Manager) EstimatedDocumentCount(opts ...*options.EstimatedDocumentCountOptions) (int64, error)
- func (m *Manager) Find(filter interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)
- func (m *Manager) FindOne(filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
- func (m *Manager) FindOneAndDelete(filter interface{}, opts ...*options.FindOneAndDeleteOptions) *mongo.SingleResult
- func (m *Manager) FindOneAndReplace(filter interface{}, replacement interface{}, ...) *mongo.SingleResult
- func (m *Manager) FindOneAndUpdate(filter interface{}, update interface{}, ...) *mongo.SingleResult
- func (m *Manager) FindOneByID(id interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
- func (m *Manager) FindPaged(q, sort interface{}, page, size int) (*mongo.Cursor, error)
- func (m *Manager) FindPagedInto(q, sort interface{}, page, size int, dest interface{}) error
- func (m *Manager) InsertMany(documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
- func (m *Manager) InsertOne(document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
- func (m *Manager) ReplaceOne(filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)
- func (m *Manager) UpdateByID(id interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
- func (m *Manager) UpdateMany(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
- func (m *Manager) UpdateOne(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
- type Trait
Constants ¶
This section is empty.
Variables ¶
View Source
var CollectionType = reflect.TypeOf((*mongo.Collection)(nil))
Functions ¶
func CurrentCollection ¶
func CurrentCollection(cdi *container.Registry) *mongo.Collection
func WithCollectionManager ¶
Types ¶
type Component ¶
type Component struct { Database string ClientOptions []*options.ClientOptions Client *mongo.Client }
func NewComponent ¶
func NewComponent(databaseName string, options ...*options.ClientOptions) *Component
type Manager ¶
type Manager struct { Context context.Context Collection *mongo.Collection Registry *container.Registry }
func (*Manager) BulkWrite ¶
func (m *Manager) BulkWrite(models []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error)
func (*Manager) CountDocuments ¶
func (m *Manager) CountDocuments(filter interface{}, opts ...*options.CountOptions) (int64, error)
func (*Manager) DeleteMany ¶
func (m *Manager) DeleteMany(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*Manager) DeleteOne ¶
func (m *Manager) DeleteOne(filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
func (*Manager) Distinct ¶
func (m *Manager) Distinct(fieldName string, filter interface{}, opts ...*options.DistinctOptions) ([]interface{}, error)
func (*Manager) EnsureIndex ¶
func (*Manager) EstimatedDocumentCount ¶
func (m *Manager) EstimatedDocumentCount(opts ...*options.EstimatedDocumentCountOptions) (int64, error)
func (*Manager) FindOne ¶
func (m *Manager) FindOne(filter interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
func (*Manager) FindOneAndDelete ¶
func (m *Manager) FindOneAndDelete(filter interface{}, opts ...*options.FindOneAndDeleteOptions) *mongo.SingleResult
func (*Manager) FindOneAndReplace ¶
func (m *Manager) FindOneAndReplace(filter interface{}, replacement interface{}, opts ...*options.FindOneAndReplaceOptions) *mongo.SingleResult
func (*Manager) FindOneAndUpdate ¶
func (m *Manager) FindOneAndUpdate(filter interface{}, update interface{}, opts ...*options.FindOneAndUpdateOptions) *mongo.SingleResult
func (*Manager) FindOneByID ¶
func (m *Manager) FindOneByID(id interface{}, opts ...*options.FindOneOptions) *mongo.SingleResult
func (*Manager) FindPagedInto ¶
func (*Manager) InsertMany ¶
func (m *Manager) InsertMany(documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
func (*Manager) InsertOne ¶
func (m *Manager) InsertOne(document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
func (*Manager) ReplaceOne ¶
func (m *Manager) ReplaceOne(filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)
func (*Manager) UpdateByID ¶
func (m *Manager) UpdateByID(id interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func (*Manager) UpdateMany ¶
func (m *Manager) UpdateMany(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
func (*Manager) UpdateOne ¶
func (m *Manager) UpdateOne(filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.