1
1
Fork 0
mirror of https://github.com/mjl-/mox.git synced 2025-04-21 21:40:01 +03:00

update to latest bstore

This commit is contained in:
Mechiel Lukkien 2025-03-28 17:34:57 +01:00
parent 6bf80d91bc
commit 789e4875ca
No known key found for this signature in database
4 changed files with 30 additions and 5 deletions
go.modgo.sum
vendor
github.com/mjl-/bstore
modules.txt

2
go.mod
View file

@ -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

4
go.sum
View file

@ -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=

View file

@ -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)
}
}
}

4
vendor/modules.txt vendored
View file

@ -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