Compare commits

...

1 Commits

Author SHA1 Message Date
c7df9d2264 v0.0.146 2023-06-07 12:59:15 +02:00
2 changed files with 16 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
package goext package goext
const GoextVersion = "0.0.145" const GoextVersion = "0.0.146"
const GoextVersionTimestamp = "2023-06-07T12:45:48+0200" const GoextVersionTimestamp = "2023-06-07T12:59:15+0200"

View File

@@ -57,8 +57,21 @@ func CreatePagination[TData any](coll *Coll[TData], token ct.CursorToken, fieldP
pipeline := make([]bson.D, 0, 3) pipeline := make([]bson.D, 0, 3)
if token.Mode == ct.CTMStart {
// no gt/lt condition
} else if token.Mode == ct.CTMNormal {
pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$or": cond}}}) pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$or": cond}}})
} else if token.Mode == ct.CTMEnd {
// false
pipeline = append(pipeline, bson.D{{Key: "$match", Value: bson.M{"$eq": bson.A{"1", "0"}}}})
}
pipeline = append(pipeline, bson.D{{Key: "$sort", Value: sort}}) pipeline = append(pipeline, bson.D{{Key: "$sort", Value: sort}})
if pageSize != nil { if pageSize != nil {