v0.0.187 forget to use function

This commit is contained in:
Julian Graf 2023-07-24 09:16:37 +02:00
parent e909d656d9
commit b1d6509294
2 changed files with 6 additions and 11 deletions

View File

@ -1,5 +1,5 @@
package goext package goext
const GoextVersion = "0.0.186" const GoextVersion = "0.0.187"
const GoextVersionTimestamp = "2023-07-24T09:13:19+0200" const GoextVersionTimestamp = "2023-07-24T09:16:37+0200"

View File

@ -3,6 +3,8 @@ package wmo
import ( import (
"context" "context"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
"gogs.mikescher.com/BlackForestBytes/goext/langext"
) )
func (c *Coll[TData]) InsertOne(ctx context.Context, valueIn TData) (TData, error) { func (c *Coll[TData]) InsertOne(ctx context.Context, valueIn TData) (TData, error) {
@ -16,13 +18,6 @@ func (c *Coll[TData]) InsertOne(ctx context.Context, valueIn TData) (TData, erro
return c.decodeSingle(ctx, mongoRes) return c.decodeSingle(ctx, mongoRes)
} }
func (c *Coll[TData]) InsertMany(ctx context.Context, valueIn []TData) (TData, error) { func (c *Coll[TData]) InsertMany(ctx context.Context, valueIn []TData) (*mongo.InsertManyResult, error) {
insRes, err := c.coll.InsertMany(ctx, langext.TovalueIn) return c.coll.InsertMany(ctx, langext.ArrayToInterface(valueIn))
if err != nil {
return *new(TData), err
}
mongoRes := c.coll.FindOne(ctx, bson.M{"_id": insRes.InsertedID})
return c.decodeSingle(ctx, mongoRes)
} }