v0.0.448 wmo marshalHook
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 25s
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 25s
This commit is contained in:
@@ -9,6 +9,10 @@ import (
|
||||
)
|
||||
|
||||
func (c *Coll[TData]) InsertOne(ctx context.Context, valueIn TData) (TData, error) {
|
||||
for _, hook := range c.marshalHooks {
|
||||
valueIn = hook(valueIn)
|
||||
}
|
||||
|
||||
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()
|
||||
@@ -36,6 +40,12 @@ func (c *Coll[TData]) InsertOneUnchecked(ctx context.Context, valueIn any) (TDat
|
||||
}
|
||||
|
||||
func (c *Coll[TData]) InsertMany(ctx context.Context, valueIn []TData) (*mongo.InsertManyResult, error) {
|
||||
for _, hook := range c.marshalHooks {
|
||||
for i := 0; i < len(valueIn); i++ {
|
||||
valueIn[i] = hook(valueIn[i])
|
||||
}
|
||||
}
|
||||
|
||||
insRes, err := c.coll.InsertMany(ctx, langext.ArrayToInterface(valueIn))
|
||||
if err != nil {
|
||||
return nil, exerr.Wrap(err, "mongo-query[insert-many] failed").Int("len(valueIn)", len(valueIn)).Str("collection", c.Name()).Build()
|
||||
|
Reference in New Issue
Block a user