diff --git a/go.mod b/go.mod index 8a8f5e9..1861f7b 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.23.0 require ( github.com/mjl-/adns v0.0.0-20250321173553-ab04b05bdfea github.com/mjl-/autocert v0.0.0-20250321204043-abab2b936e31 - github.com/mjl-/bstore v0.0.8 + github.com/mjl-/bstore v0.0.9 github.com/mjl-/flate v0.0.0-20250221133712-6372d09eb978 github.com/mjl-/sconf v0.0.7 github.com/mjl-/sherpa v0.6.7 diff --git a/go.sum b/go.sum index 0395687..5c47b07 100644 --- a/go.sum +++ b/go.sum @@ -28,8 +28,8 @@ github.com/mjl-/adns v0.0.0-20250321173553-ab04b05bdfea h1:8dftsVL1tHhRksXzFZRhS github.com/mjl-/adns v0.0.0-20250321173553-ab04b05bdfea/go.mod h1:rWZMqGA2HoBm5b5q/A5J8u1sSVuEYh6zBz9tMoVs+RU= github.com/mjl-/autocert v0.0.0-20250321204043-abab2b936e31 h1:6MFGOLPGf6VzHWkKv8waSzJMMS98EFY2LVKPRHffCyo= github.com/mjl-/autocert v0.0.0-20250321204043-abab2b936e31/go.mod h1:taMFU86abMxKLPV4Bynhv8enbYmS67b8LG80qZv2Qus= -github.com/mjl-/bstore v0.0.8 h1:9pojrmRTJZZOx9yAUbldq6CZCBuRbwNtk+N+SRCEUVk= -github.com/mjl-/bstore v0.0.8/go.mod h1:92/K8lyfA4z5W0P9O0TqCenNnC76p2YFdWJSZChzBkk= +github.com/mjl-/bstore v0.0.9 h1:j8HVXL10Arbk4ujeRGwns8gipH1N1TZn853inQ42FgY= +github.com/mjl-/bstore v0.0.9/go.mod h1:xzIpSfcFosgPJ6h+vsdIt0pzCq4i8hhMuHPQJ0aHQhM= github.com/mjl-/flate v0.0.0-20250221133712-6372d09eb978 h1:Eg5DfI3/00URzGErujKus6a3O0kyXzF8vjoDZzH/gig= github.com/mjl-/flate v0.0.0-20250221133712-6372d09eb978/go.mod h1:QBkFtjai3AiQQuUu7pVh6PA06Vd3oa68E+vddf/UBOs= github.com/mjl-/sconf v0.0.7 h1:bdBcSFZCDFMm/UdBsgNCsjkYmKrSgYwp7rAOoufwHe4= diff --git a/vendor/github.com/mjl-/bstore/query.go b/vendor/github.com/mjl-/bstore/query.go index 5914e35..689f242 100644 --- a/vendor/github.com/mjl-/bstore/query.go +++ b/vendor/github.com/mjl-/bstore/query.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "iter" "reflect" "slices" @@ -1233,3 +1234,27 @@ func (q *Query[T]) ForEach(fn func(value T) error) (rerr error) { return fn(v) }) } + +// All returns an iterator over all selected records. +// +// All automatically respositions the cursor when data is changed while iterating. +// Changes to data aren't necessarily reflected in the yielded values. This can +// happen when a sort order isn't executed using an index: All gathers and sorts (a +// subset of) values before yielding them and does not reapply filtering and does +// not necessarily yield the updated values. +func (q *Query[T]) All() iter.Seq2[T, error] { + return func(yield func(T, error) bool) { + var stopped bool + err := q.ForEach(func(v T) error { + if !yield(v, nil) { + stopped = true + return StopForEach + } + return nil + }) + if !stopped && err != nil { + var zero T + yield(zero, err) + } + } +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 7099b81..71c7346 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -16,8 +16,8 @@ github.com/mjl-/adns/internal/singleflight # github.com/mjl-/autocert v0.0.0-20250321204043-abab2b936e31 ## explicit; go 1.20 github.com/mjl-/autocert -# github.com/mjl-/bstore v0.0.8 -## explicit; go 1.22 +# github.com/mjl-/bstore v0.0.9 +## explicit; go 1.23.0 github.com/mjl-/bstore # github.com/mjl-/flate v0.0.0-20250221133712-6372d09eb978 ## explicit; go 1.21