Skip to content

Commit

Permalink
Go 1.23.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncruces committed Feb 21, 2025
1 parent 5f423bf commit d51fb4d
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 160 deletions.
15 changes: 11 additions & 4 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package sqlite3
import (
"context"
"fmt"
"iter"
"math"
"math/rand"
"net/url"
Expand Down Expand Up @@ -503,10 +504,16 @@ func (c *Conn) error(rc res_t, sql ...string) error {
return c.sqlite.error(rc, c.handle, sql...)
}

func (c *Conn) stmtsIter(yield func(*Stmt) bool) {
for _, s := range c.stmts {
if !yield(s) {
break
// Stmts returns an iterator for the prepared statements
// associated with the database connection.
//
// https://sqlite.org/c3ref/next_stmt.html
func (c *Conn) Stmts() iter.Seq[*Stmt] {
return func(yield func(*Stmt) bool) {
for _, s := range c.stmts {
if !yield(s) {
break
}
}
}
}
11 changes: 0 additions & 11 deletions conn_iter.go

This file was deleted.

9 changes: 0 additions & 9 deletions conn_old.go

This file was deleted.

2 changes: 1 addition & 1 deletion embed/bcw2/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ncruces/go-sqlite3/embed/bcw2

go 1.22.0
go 1.23.0

toolchain go1.24.0

Expand Down
70 changes: 0 additions & 70 deletions ext/fileio/coro.go

This file was deleted.

19 changes: 16 additions & 3 deletions ext/fileio/fsdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package fileio

import (
"io/fs"
"iter"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -63,7 +64,7 @@ func (d fsdir) Open() (sqlite3.VTabCursor, error) {
type cursor struct {
fsdir
base string
resume resume
resume func() (entry, bool)
cancel func()
curr entry
eof bool
Expand Down Expand Up @@ -101,14 +102,26 @@ func (c *cursor) Filter(idxNum int, idxStr string, arg ...sqlite3.Value) error {
c.base = base
}

c.resume, c.cancel = pull(c, root)
c.resume, c.cancel = iter.Pull(func(yield func(entry) bool) {
walkDir := func(path string, d fs.DirEntry, err error) error {
if yield(entry{d, err, path}) {
return nil
}
return fs.SkipAll
}
if c.fsys != nil {
fs.WalkDir(c.fsys, root, walkDir)
} else {
filepath.WalkDir(root, walkDir)
}
})
c.eof = false
c.rowID = 0
return c.Next()
}

func (c *cursor) Next() error {
curr, ok := next(c)
curr, ok := c.resume()
c.curr = curr
c.eof = !ok
c.rowID++
Expand Down
29 changes: 0 additions & 29 deletions ext/fileio/fsdir_coro.go

This file was deleted.

31 changes: 0 additions & 31 deletions ext/fileio/fsdir_iter.go

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ncruces/go-sqlite3

go 1.22.0
go 1.23.0

toolchain go1.24.0

Expand Down
2 changes: 1 addition & 1 deletion gormlite/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/ncruces/go-sqlite3/gormlite

go 1.22.0
go 1.23.0

toolchain go1.24.0

Expand Down

0 comments on commit d51fb4d

Please sign in to comment.