v0.0.141
This commit is contained in:
parent
b16d5152c7
commit
e89e2c18f2
@ -3,6 +3,7 @@ package wmo
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"go.mongodb.org/mongo-driver/bson"
|
"go.mongodb.org/mongo-driver/bson"
|
||||||
|
"go.mongodb.org/mongo-driver/mongo"
|
||||||
"go.mongodb.org/mongo-driver/mongo/options"
|
"go.mongodb.org/mongo-driver/mongo/options"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -35,6 +36,15 @@ func (c *Coll[TData]) UpdateOneByID(ctx context.Context, id EntityID, updateQuer
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Coll[TData]) UpdateMany(ctx context.Context, filterQuery bson.M, updateQuery bson.M) (*mongo.UpdateResult, error) {
|
||||||
|
res, err := c.coll.UpdateMany(ctx, filterQuery, updateQuery)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return res, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Coll[TData]) ReplaceOne(ctx context.Context, id EntityID, value TData) error {
|
func (c *Coll[TData]) ReplaceOne(ctx context.Context, id EntityID, value TData) error {
|
||||||
_, err := c.coll.UpdateOne(ctx, bson.M{"_id": id}, value)
|
_, err := c.coll.UpdateOne(ctx, bson.M{"_id": id}, value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user