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