Documentation
¶
Index ¶
- func ConnectDB(cfg *config.Env) (*mongo.Client, error)
- type NoSql
- func (pkg *NoSql) Aggregate(ctx context.Context, coll *mongo.Collection, pipeline interface{}, ...) error
- func (pkg *NoSql) BulkWrite(ctx context.Context, coll *mongo.Collection, operations []mongo.WriteModel, ...) (*mongo.BulkWriteResult, error)
- func (pkg *NoSql) Close(ctx context.Context) error
- func (pkg *NoSql) Collection(databaseName, collectionName string) *mongo.Collection
- func (pkg *NoSql) CountDocuments(ctx context.Context, coll *mongo.Collection, filter interface{}, ...) (int64, error)
- func (pkg *NoSql) CreateIndex(ctx context.Context, coll *mongo.Collection, keys interface{}, ...) (string, error)
- func (pkg *NoSql) DeleteMany(ctx context.Context, coll *mongo.Collection, filter interface{}, ...) (*mongo.DeleteResult, error)
- func (pkg *NoSql) DeleteOne(ctx context.Context, coll *mongo.Collection, filter interface{}, ...) (*mongo.DeleteResult, error)
- func (pkg *NoSql) Find(ctx context.Context, coll *mongo.Collection, filter interface{}, ...) error
- func (pkg *NoSql) FindOne(ctx context.Context, coll *mongo.Collection, filter interface{}, ...) error
- func (pkg *NoSql) HealthCheck(ctx context.Context) error
- func (pkg *NoSql) InsertMany(ctx context.Context, coll *mongo.Collection, documents []interface{}, ...) (*mongo.InsertManyResult, error)
- func (pkg *NoSql) InsertOne(ctx context.Context, coll *mongo.Collection, document interface{}, ...) (*mongo.InsertOneResult, error)
- func (pkg *NoSql) ReplaceOne(ctx context.Context, coll *mongo.Collection, filter interface{}, ...) (*mongo.UpdateResult, error)
- func (pkg *NoSql) UpdateMany(ctx context.Context, coll *mongo.Collection, filter interface{}, ...) (*mongo.UpdateResult, error)
- func (pkg *NoSql) UpdateOne(ctx context.Context, coll *mongo.Collection, filter interface{}, ...) (*mongo.UpdateResult, error)
- func (pkg *NoSql) Watch(ctx context.Context, coll *mongo.Collection, pipeline interface{}, ...) (*mongo.ChangeStream, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type NoSql ¶
func (*NoSql) Aggregate ¶
func (pkg *NoSql) Aggregate(ctx context.Context, coll *mongo.Collection, pipeline interface{}, result interface{}, opts ...*options.AggregateOptions) error
Aggregate performs aggregation operations
func (*NoSql) BulkWrite ¶
func (pkg *NoSql) BulkWrite(ctx context.Context, coll *mongo.Collection, operations []mongo.WriteModel, opts ...*options.BulkWriteOptions) (*mongo.BulkWriteResult, error)
BulkWrite performs bulk operations
func (*NoSql) Collection ¶
func (pkg *NoSql) Collection(databaseName, collectionName string) *mongo.Collection
Collection returns a handle for a MongoDB collection
func (*NoSql) CountDocuments ¶
func (pkg *NoSql) CountDocuments(ctx context.Context, coll *mongo.Collection, filter interface{}, opts ...*options.CountOptions) (int64, error)
CountDocuments counts documents matching the filter
func (*NoSql) CreateIndex ¶
func (pkg *NoSql) CreateIndex(ctx context.Context, coll *mongo.Collection, keys interface{}, opts *options.IndexOptions) (string, error)
CreateIndex creates an index on the collection
func (*NoSql) DeleteMany ¶
func (pkg *NoSql) DeleteMany(ctx context.Context, coll *mongo.Collection, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
DeleteMany deletes multiple documents
func (*NoSql) DeleteOne ¶
func (pkg *NoSql) DeleteOne(ctx context.Context, coll *mongo.Collection, filter interface{}, opts ...*options.DeleteOptions) (*mongo.DeleteResult, error)
DeleteOne deletes a single document
func (*NoSql) Find ¶
func (pkg *NoSql) Find(ctx context.Context, coll *mongo.Collection, filter interface{}, results interface{}, opts ...*options.FindOptions) error
Find finds multiple documents
func (*NoSql) FindOne ¶
func (pkg *NoSql) FindOne(ctx context.Context, coll *mongo.Collection, filter interface{}, result interface{}, opts ...*options.FindOneOptions) error
FindOne finds a single document
func (*NoSql) HealthCheck ¶
HealthCheck verifies the MongoDB connection
func (*NoSql) InsertMany ¶
func (pkg *NoSql) InsertMany(ctx context.Context, coll *mongo.Collection, documents []interface{}, opts ...*options.InsertManyOptions) (*mongo.InsertManyResult, error)
InsertMany inserts multiple documents
func (*NoSql) InsertOne ¶
func (pkg *NoSql) InsertOne(ctx context.Context, coll *mongo.Collection, document interface{}, opts ...*options.InsertOneOptions) (*mongo.InsertOneResult, error)
InsertOne inserts a single document
func (*NoSql) ReplaceOne ¶
func (pkg *NoSql) ReplaceOne(ctx context.Context, coll *mongo.Collection, filter interface{}, replacement interface{}, opts ...*options.ReplaceOptions) (*mongo.UpdateResult, error)
ReplaceOne replaces a single document
func (*NoSql) UpdateMany ¶
func (pkg *NoSql) UpdateMany(ctx context.Context, coll *mongo.Collection, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
UpdateMany updates multiple documents
func (*NoSql) UpdateOne ¶
func (pkg *NoSql) UpdateOne(ctx context.Context, coll *mongo.Collection, filter interface{}, update interface{}, opts ...*options.UpdateOptions) (*mongo.UpdateResult, error)
UpdateOne updates a single document
func (*NoSql) Watch ¶
func (pkg *NoSql) Watch(ctx context.Context, coll *mongo.Collection, pipeline interface{}, opts ...*options.ChangeStreamOptions) (*mongo.ChangeStream, error)
Watch monitors changes in the collection
Click to show internal directories.
Click to hide internal directories.