v0.0.248 exerr in wmo package
Some checks failed
Build Docker and Deploy / Run goext test-suite (push) Failing after 55s

This commit is contained in:
2023-08-21 15:08:35 +02:00
parent 9b752a911c
commit ae43cbb623
12 changed files with 128 additions and 52 deletions

View File

@@ -1,9 +1,9 @@
package wmo
import (
"errors"
"go.mongodb.org/mongo-driver/bson"
ct "gogs.mikescher.com/BlackForestBytes/goext/cursortoken"
"gogs.mikescher.com/BlackForestBytes/goext/exerr"
)
func CreatePagination[TData any](coll *Coll[TData], token ct.CursorToken, fieldPrimary string, sortPrimary ct.SortDirection, fieldSecondary *string, sortSecondary *ct.SortDirection, pageSize *int) ([]bson.D, error) {
@@ -13,7 +13,7 @@ func CreatePagination[TData any](coll *Coll[TData], token ct.CursorToken, fieldP
valuePrimary, err := coll.getTokenValueAsMongoType(token.ValuePrimary, fieldPrimary)
if err != nil {
return nil, err
return nil, exerr.Wrap(err, "failed to get (primary) token-value as mongo-type").Build()
}
if sortPrimary == ct.SortASC {
@@ -30,7 +30,7 @@ func CreatePagination[TData any](coll *Coll[TData], token ct.CursorToken, fieldP
valueSecondary, err := coll.getTokenValueAsMongoType(token.ValueSecondary, *fieldSecondary)
if err != nil {
return nil, err
return nil, exerr.Wrap(err, "failed to get (secondary) token-value as mongo-type").Build()
}
if *sortSecondary == ct.SortASC {
@@ -73,7 +73,7 @@ func CreatePagination[TData any](coll *Coll[TData], token ct.CursorToken, fieldP
} else {
return nil, errors.New("unknown ct mode: " + string(token.Mode))
return nil, exerr.New(exerr.TypeInternal, "unknown ct mode: "+string(token.Mode)).Any("token.Mode", token.Mode).Build()
}