Skip to content

Commit a9d61d5

Browse files
committed
use pointer receiver
1 parent fca908b commit a9d61d5

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

_example/vtable/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ package main
33
import (
44
"database/sql"
55
"fmt"
6-
"github.com/mattn/go-sqlite3"
76
"log"
7+
8+
"github.com/mattn/go-sqlite3"
89
)
910

1011
func main() {
1112
sql.Register("sqlite3_with_extensions", &sqlite3.SQLiteDriver{
1213
ConnectHook: func(conn *sqlite3.SQLiteConn) error {
13-
return conn.CreateModule("github", githubModule{})
14+
return conn.CreateModule("github", &githubModule{})
1415
},
1516
})
1617
db, err := sql.Open("sqlite3_with_extensions", ":memory:")

_example/vtable/vtable.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ type GithubRepo struct {
1919
type githubModule struct {
2020
}
2121

22-
func (m githubModule) Create(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
22+
func (m *githubModule) Create(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
2323
err := c.DeclareVTab(fmt.Sprintf(`
2424
CREATE TABLE %s (
2525
id INT,
@@ -33,11 +33,11 @@ func (m githubModule) Create(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab
3333
return &ghRepoTable{}, nil
3434
}
3535

36-
func (m githubModule) Connect(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
36+
func (m *githubModule) Connect(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
3737
return m.Create(c, args)
3838
}
3939

40-
func (m githubModule) DestroyModule() {}
40+
func (m *githubModule) DestroyModule() {}
4141

4242
type ghRepoTable struct {
4343
repos []GithubRepo

0 commit comments

Comments
 (0)