v0.0.152
This commit is contained in:
parent
6589e8d5cd
commit
dc2d8a9103
@ -1,5 +1,5 @@
|
|||||||
package goext
|
package goext
|
||||||
|
|
||||||
const GoextVersion = "0.0.151"
|
const GoextVersion = "0.0.152"
|
||||||
|
|
||||||
const GoextVersionTimestamp = "2023-06-07T17:57:03+0200"
|
const GoextVersionTimestamp = "2023-06-08T16:17:01+0200"
|
||||||
|
@ -46,7 +46,7 @@ func (c *Coll[TData]) UpdateMany(ctx context.Context, filterQuery bson.M, update
|
|||||||
}
|
}
|
||||||
|
|
||||||
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}, bson.M{"$set": value})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ func (c *Coll[TData]) ReplaceOne(ctx context.Context, id EntityID, value TData)
|
|||||||
func (c *Coll[TData]) FindOneAndReplace(ctx context.Context, id EntityID, value TData) (TData, error) {
|
func (c *Coll[TData]) FindOneAndReplace(ctx context.Context, id EntityID, value TData) (TData, error) {
|
||||||
var res TData
|
var res TData
|
||||||
|
|
||||||
err := c.coll.FindOneAndUpdate(ctx, bson.M{"_id": id}, value, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(&res)
|
err := c.coll.FindOneAndUpdate(ctx, bson.M{"_id": id}, bson.M{"$set": value}, options.FindOneAndUpdate().SetReturnDocument(options.After)).Decode(&res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return *new(TData), err
|
return *new(TData), err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user