aboutsummaryrefslogtreecommitdiff
path: root/_example
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2017-03-05 20:49:45 +0900
committerYasuhiro Matsumoto <mattn.jp@gmail.com>2017-03-05 20:49:45 +0900
commita9d61d54c6d919d7f627743daa26e54687244566 (patch)
treede8f807bcba871450b23a771b9a8f5d1da4e190c /_example
parentfix import path (diff)
downloadgolite-a9d61d54c6d919d7f627743daa26e54687244566.tar.gz
golite-a9d61d54c6d919d7f627743daa26e54687244566.tar.xz
use pointer receiver
Diffstat (limited to '_example')
-rw-r--r--_example/vtable/main.go5
-rw-r--r--_example/vtable/vtable.go6
2 files changed, 6 insertions, 5 deletions
diff --git a/_example/vtable/main.go b/_example/vtable/main.go
index 442069f..2f3b8a4 100644
--- a/_example/vtable/main.go
+++ b/_example/vtable/main.go
@@ -3,14 +3,15 @@ package main
import (
"database/sql"
"fmt"
- "github.com/mattn/go-sqlite3"
"log"
+
+ "github.com/mattn/go-sqlite3"
)
func main() {
sql.Register("sqlite3_with_extensions", &sqlite3.SQLiteDriver{
ConnectHook: func(conn *sqlite3.SQLiteConn) error {
- return conn.CreateModule("github", githubModule{})
+ return conn.CreateModule("github", &githubModule{})
},
})
db, err := sql.Open("sqlite3_with_extensions", ":memory:")
diff --git a/_example/vtable/vtable.go b/_example/vtable/vtable.go
index 40b460f..eb80e2a 100644
--- a/_example/vtable/vtable.go
+++ b/_example/vtable/vtable.go
@@ -19,7 +19,7 @@ type GithubRepo struct {
type githubModule struct {
}
-func (m githubModule) Create(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
+func (m *githubModule) Create(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
err := c.DeclareVTab(fmt.Sprintf(`
CREATE TABLE %s (
id INT,
@@ -33,11 +33,11 @@ func (m githubModule) Create(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab
return &ghRepoTable{}, nil
}
-func (m githubModule) Connect(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
+func (m *githubModule) Connect(c *sqlite3.SQLiteConn, args []string) (sqlite3.VTab, error) {
return m.Create(c, args)
}
-func (m githubModule) DestroyModule() {}
+func (m *githubModule) DestroyModule() {}
type ghRepoTable struct {
repos []GithubRepo