From a4b5f33d159836cfa95695a8a8ac7151c9ee5fff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Wed, 7 Jun 2023 11:28:07 +0200 Subject: [PATCH] v0.0.142 --- .idea/goext.iml | 6 +++++- wmo/queryList.go | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.idea/goext.iml b/.idea/goext.iml index 5e764c4..49ee533 100644 --- a/.idea/goext.iml +++ b/.idea/goext.iml @@ -1,6 +1,10 @@ - + + + + diff --git a/wmo/queryList.go b/wmo/queryList.go index 9ff1af9..81d8618 100644 --- a/wmo/queryList.go +++ b/wmo/queryList.go @@ -58,6 +58,10 @@ func (c *Coll[TData]) List(ctx context.Context, filter ct.Filter, pageSize *int, return entities, nextToken, nil } +type countRes struct { + Count int64 `bson:"c"` +} + func (c *Coll[TData]) Count(ctx context.Context, filter ct.Filter) (int64, error) { pipeline := filter.FilterQuery() @@ -68,12 +72,8 @@ func (c *Coll[TData]) Count(ctx context.Context, filter ct.Filter) (int64, error return 0, err } - type res struct { - Count int64 `bson:"c"` - } - if cursor.Next(ctx) { - v := res{} + v := countRes{} err = cursor.Decode(&v) if err != nil { return 0, err