Skip to content

Commit f536765

Browse files
committed
Go 1.23.
1 parent 12034c4 commit f536765

File tree

10 files changed

+30
-160
lines changed

10 files changed

+30
-160
lines changed

conn.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package sqlite3
33
import (
44
"context"
55
"fmt"
6+
"iter"
67
"math"
78
"math/rand"
89
"net/url"
@@ -503,10 +504,16 @@ func (c *Conn) error(rc res_t, sql ...string) error {
503504
return c.sqlite.error(rc, c.handle, sql...)
504505
}
505506

506-
func (c *Conn) stmtsIter(yield func(*Stmt) bool) {
507-
for _, s := range c.stmts {
508-
if !yield(s) {
509-
break
507+
// Stmts returns an iterator for the prepared statements
508+
// associated with the database connection.
509+
//
510+
// https://sqlite.org/c3ref/next_stmt.html
511+
func (c *Conn) Stmts() iter.Seq[*Stmt] {
512+
return func(yield func(*Stmt) bool) {
513+
for _, s := range c.stmts {
514+
if !yield(s) {
515+
break
516+
}
510517
}
511518
}
512519
}

conn_iter.go

Lines changed: 0 additions & 11 deletions
This file was deleted.

conn_old.go

Lines changed: 0 additions & 9 deletions
This file was deleted.

embed/bcw2/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ncruces/go-sqlite3/embed/bcw2
22

3-
go 1.22.0
3+
go 1.23.0
44

55
toolchain go1.24.0
66

ext/fileio/coro.go

Lines changed: 0 additions & 70 deletions
This file was deleted.

ext/fileio/fsdir.go

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package fileio
22

33
import (
44
"io/fs"
5+
"iter"
56
"os"
67
"path"
78
"path/filepath"
@@ -63,7 +64,7 @@ func (d fsdir) Open() (sqlite3.VTabCursor, error) {
6364
type cursor struct {
6465
fsdir
6566
base string
66-
resume resume
67+
resume func() (entry, bool)
6768
cancel func()
6869
curr entry
6970
eof bool
@@ -101,14 +102,26 @@ func (c *cursor) Filter(idxNum int, idxStr string, arg ...sqlite3.Value) error {
101102
c.base = base
102103
}
103104

104-
c.resume, c.cancel = pull(c, root)
105+
c.resume, c.cancel = iter.Pull(func(yield func(entry) bool) {
106+
walkDir := func(path string, d fs.DirEntry, err error) error {
107+
if yield(entry{d, err, path}) {
108+
return nil
109+
}
110+
return fs.SkipAll
111+
}
112+
if c.fsys != nil {
113+
fs.WalkDir(c.fsys, root, walkDir)
114+
} else {
115+
filepath.WalkDir(root, walkDir)
116+
}
117+
})
105118
c.eof = false
106119
c.rowID = 0
107120
return c.Next()
108121
}
109122

110123
func (c *cursor) Next() error {
111-
curr, ok := next(c)
124+
curr, ok := c.resume()
112125
c.curr = curr
113126
c.eof = !ok
114127
c.rowID++

ext/fileio/fsdir_coro.go

Lines changed: 0 additions & 29 deletions
This file was deleted.

ext/fileio/fsdir_iter.go

Lines changed: 0 additions & 31 deletions
This file was deleted.

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ncruces/go-sqlite3
22

3-
go 1.22.0
3+
go 1.23.0
44

55
toolchain go1.24.0
66

gormlite/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ncruces/go-sqlite3/gormlite
22

3-
go 1.22.0
3+
go 1.23.0
44

55
toolchain go1.24.0
66

0 commit comments

Comments
 (0)