Skip to content

Commit c91bca4

Browse files
committed
update go version to 1.19
1 parent 00b02e0 commit c91bca4

21 files changed

+88
-89
lines changed

.github/workflows/go.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
matrix:
1616
os: [ubuntu-latest, macos-latest]
17-
go: ['1.18', '1.19', '1.20']
17+
go: ['1.19', '1.20', '1.21']
1818
fail-fast: false
1919
env:
2020
OS: ${{ matrix.os }}
@@ -64,7 +64,7 @@ jobs:
6464

6565
strategy:
6666
matrix:
67-
go: ['1.18', '1.19', '1.20']
67+
go: ['1.19', '1.20', '1.21']
6868
fail-fast: false
6969
env:
7070
OS: windows-latest

_example/limit/limit.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"github.com/mattn/go-sqlite3"
1111
)
1212

13-
func createBulkInsertQuery(n int, start int) (query string, args []interface{}) {
13+
func createBulkInsertQuery(n int, start int) (query string, args []any) {
1414
values := make([]string, n)
15-
args = make([]interface{}, n*2)
15+
args = make([]any, n*2)
1616
pos := 0
1717
for i := 0; i < n; i++ {
1818
values[i] = "(?, ?)"
@@ -27,7 +27,7 @@ func createBulkInsertQuery(n int, start int) (query string, args []interface{})
2727
return
2828
}
2929

30-
func bulkInsert(db *sql.DB, query string, args []interface{}) (err error) {
30+
func bulkInsert(db *sql.DB, query string, args []any) (err error) {
3131
stmt, err := db.Prepare(query)
3232
if err != nil {
3333
return

_example/vtable/vtable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (vc *ghRepoCursor) Column(c *sqlite3.SQLiteContext, col int) error {
9393
return nil
9494
}
9595

96-
func (vc *ghRepoCursor) Filter(idxNum int, idxStr string, vals []interface{}) error {
96+
func (vc *ghRepoCursor) Filter(idxNum int, idxStr string, vals []any) error {
9797
vc.index = 0
9898
return nil
9999
}

_example/vtable_eponymous_only/vtable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (vc *seriesCursor) Column(c *sqlite3.SQLiteContext, col int) error {
7777
return nil
7878
}
7979

80-
func (vc *seriesCursor) Filter(idxNum int, idxStr string, vals []interface{}) error {
80+
func (vc *seriesCursor) Filter(idxNum int, idxStr string, vals []any) error {
8181
switch {
8282
case len(vals) < 1:
8383
vc.seriesTable.start = 0

callback.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ func preUpdateHookTrampoline(handle unsafe.Pointer, dbHandle uintptr, op int, db
100100
// Use handles to avoid passing Go pointers to C.
101101
type handleVal struct {
102102
db *SQLiteConn
103-
val interface{}
103+
val any
104104
}
105105

106106
var handleLock sync.Mutex
107107
var handleVals = make(map[unsafe.Pointer]handleVal)
108108

109-
func newHandle(db *SQLiteConn, v interface{}) unsafe.Pointer {
109+
func newHandle(db *SQLiteConn, v any) unsafe.Pointer {
110110
handleLock.Lock()
111111
defer handleLock.Unlock()
112112
val := handleVal{db: db, val: v}
@@ -124,7 +124,7 @@ func lookupHandleVal(handle unsafe.Pointer) handleVal {
124124
return handleVals[handle]
125125
}
126126

127-
func lookupHandle(handle unsafe.Pointer) interface{} {
127+
func lookupHandle(handle unsafe.Pointer) any {
128128
return lookupHandleVal(handle).val
129129
}
130130

@@ -238,7 +238,7 @@ func callbackArg(typ reflect.Type) (callbackArgConverter, error) {
238238
switch typ.Kind() {
239239
case reflect.Interface:
240240
if typ.NumMethod() != 0 {
241-
return nil, errors.New("the only supported interface type is interface{}")
241+
return nil, errors.New("the only supported interface type is any")
242242
}
243243
return callbackArgGeneric, nil
244244
case reflect.Slice:

callback_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestCallbackArgCast(t *testing.T) {
5353

5454
func TestCallbackConverters(t *testing.T) {
5555
tests := []struct {
56-
v interface{}
56+
v any
5757
err bool
5858
}{
5959
// Unfortunately, we can't tell which converter was returned,
@@ -104,7 +104,7 @@ func TestCallbackConverters(t *testing.T) {
104104
}
105105

106106
func TestCallbackReturnAny(t *testing.T) {
107-
udf := func() interface{} {
107+
udf := func() any {
108108
return 1
109109
}
110110

convert.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var errNilPtr = errors.New("destination pointer is nil") // embedded in descript
2323
// convertAssign copies to dest the value in src, converting it if possible.
2424
// An error is returned if the copy would result in loss of information.
2525
// dest should be a pointer type.
26-
func convertAssign(dest, src interface{}) error {
26+
func convertAssign(dest, src any) error {
2727
// Common cases, without reflect.
2828
switch s := src.(type) {
2929
case string:
@@ -55,7 +55,7 @@ func convertAssign(dest, src interface{}) error {
5555
}
5656
*d = string(s)
5757
return nil
58-
case *interface{}:
58+
case *any:
5959
if d == nil {
6060
return errNilPtr
6161
}
@@ -97,7 +97,7 @@ func convertAssign(dest, src interface{}) error {
9797
}
9898
case nil:
9999
switch d := dest.(type) {
100-
case *interface{}:
100+
case *any:
101101
if d == nil {
102102
return errNilPtr
103103
}
@@ -149,7 +149,7 @@ func convertAssign(dest, src interface{}) error {
149149
*d = bv.(bool)
150150
}
151151
return err
152-
case *interface{}:
152+
case *any:
153153
*d = src
154154
return nil
155155
}
@@ -256,7 +256,7 @@ func cloneBytes(b []byte) []byte {
256256
return c
257257
}
258258

259-
func asString(src interface{}) string {
259+
func asString(src any) string {
260260
switch v := src.(type) {
261261
case string:
262262
return v

doc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ You can also use database/sql.Conn.Raw (Go >= 1.13):
9595
conn, err := db.Conn(context.Background())
9696
// if err != nil { ... }
9797
defer conn.Close()
98-
err = conn.Raw(func (driverConn interface{}) error {
98+
err = conn.Raw(func (driverConn any) error {
9999
sqliteConn := driverConn.(*sqlite3.SQLiteConn)
100100
// ... use sqliteConn
101101
})

go.mod

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

3-
go 1.16
3+
go 1.19
44

55
retract (
66
[v2.0.0+incompatible, v2.0.6+incompatible] // Accidental; no major changes or features.

sqlite3.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -607,10 +607,9 @@ func (c *SQLiteConn) RegisterAuthorizer(callback func(int, string, string, strin
607607
// RegisterFunc makes a Go function available as a SQLite function.
608608
//
609609
// The Go function can have arguments of the following types: any
610-
// numeric type except complex, bool, []byte, string and
611-
// interface{}. interface{} arguments are given the direct translation
612-
// of the SQLite data type: int64 for INTEGER, float64 for FLOAT,
613-
// []byte for BLOB, string for TEXT.
610+
// numeric type except complex, bool, []byte, string and any.
611+
// any arguments are given the direct translation of the SQLite data type:
612+
// int64 for INTEGER, float64 for FLOAT, []byte for BLOB, string for TEXT.
614613
//
615614
// The function can additionally be variadic, as long as the type of
616615
// the variadic argument is one of the above.
@@ -620,7 +619,7 @@ func (c *SQLiteConn) RegisterAuthorizer(callback func(int, string, string, strin
620619
// optimizations in its queries.
621620
//
622621
// See _example/go_custom_funcs for a detailed example.
623-
func (c *SQLiteConn) RegisterFunc(name string, impl interface{}, pure bool) error {
622+
func (c *SQLiteConn) RegisterFunc(name string, impl any, pure bool) error {
624623
var fi functionInfo
625624
fi.f = reflect.ValueOf(impl)
626625
t := fi.f.Type()
@@ -702,7 +701,7 @@ func sqlite3CreateFunction(db *C.sqlite3, zFunctionName *C.char, nArg C.int, eTe
702701
// return an error in addition to their other return values.
703702
//
704703
// See _example/go_custom_funcs for a detailed example.
705-
func (c *SQLiteConn) RegisterAggregator(name string, impl interface{}, pure bool) error {
704+
func (c *SQLiteConn) RegisterAggregator(name string, impl any, pure bool) error {
706705
var ai aggInfo
707706
ai.constructor = reflect.ValueOf(impl)
708707
t := ai.constructor.Type()

0 commit comments

Comments
 (0)