v0.0.305
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m21s
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 1m21s
This commit is contained in:
parent
f3ecba3883
commit
398ed56d32
@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.304"
|
||||
const GoextVersion = "0.0.305"
|
||||
|
||||
const GoextVersionTimestamp = "2023-11-09T09:26:46+0100"
|
||||
const GoextVersionTimestamp = "2023-11-09T09:35:56+0100"
|
||||
|
@ -21,6 +21,20 @@ func (c *Coll[TData]) InsertOne(ctx context.Context, valueIn TData) (TData, erro
|
||||
return *r, nil
|
||||
}
|
||||
|
||||
// InsertOneUnchecked behaves the same as InsertOne, but allows arbitrary data to be inserted (valueIn is any instead of TData)
|
||||
func (c *Coll[TData]) InsertOneUnchecked(ctx context.Context, valueIn any) (TData, error) {
|
||||
insRes, err := c.coll.InsertOne(ctx, valueIn)
|
||||
if err != nil {
|
||||
return *new(TData), exerr.Wrap(err, "mongo-query[insert-one] failed").Str("collection", c.Name()).Build()
|
||||
}
|
||||
|
||||
r, err := c.findOneInternal(ctx, bson.M{"_id": insRes.InsertedID}, false)
|
||||
if err != nil {
|
||||
return *new(TData), exerr.Wrap(err, "mongo-query[insert-one] failed").Str("collection", c.Name()).Build()
|
||||
}
|
||||
return *r, nil
|
||||
}
|
||||
|
||||
func (c *Coll[TData]) InsertMany(ctx context.Context, valueIn []TData) (*mongo.InsertManyResult, error) {
|
||||
insRes, err := c.coll.InsertMany(ctx, langext.ArrayToInterface(valueIn))
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user