diff --git a/README.md b/README.md index b153c13..a9c8b08 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,15 @@ package main func main() { // Define your hooks - hooks := sqlhook.Hooks{ - Query: func(fn sqlhook.QueryFn, query string, args ...interface{}) (driver.Rows, error) { + hooks := sqlhooks.Hooks{ + Query: func(fn sqlhooks.QueryFn, query string, args ...interface{}) (driver.Rows, error) { defer func(t time.Time) { log.Printf("query: %s, args: %v, took: %s\n", query, args, time.Since(t)) }(time.Now()) return fn() }, - Exec: func(fn sqlhook.ExecFn, query string, args ...interface{}) (driver.Result, error) { + Exec: func(fn sqlhooks.ExecFn, query string, args ...interface{}) (driver.Result, error) { defer func(t time.Time) { log.Printf("exec: %s, args: %v, took: %s\n", query, args, time.Since(t)) }(time.Now()) @@ -31,7 +31,7 @@ func main() { // Register the driver // sqlite-hooked is the attached driver, and sqlite3 is where we're attaching to - sqlhook.Register("sqlite-hooked", sqlhook.NewDriver("sqlite3", &hooks)) + sqlhooks.Register("sqlite-hooked", sqlhooks.NewDriver("sqlite3", &hooks)) // Connect to attached driver db, _ := sql.Open("sqlite-hooked", ":memory:") @@ -43,7 +43,7 @@ func main() { } ``` -sqlhook will intercept Query and Exec functions and instead run your hooks, output will look like: +sqlhooks will intercept Query and Exec functions and instead run your hooks, output will look like: ``` 2000/01/01 00:01:02 exec: CREATE TABLE t (id INTEGER, text VARCHAR(16)), args: [], took: 226.169µs 2000/01/01 00:01:02 exec: INSERT into t (text) VALUES(?), (?)), args: [foo bar], took: 26.822µs diff --git a/fakedb_test.go b/fakedb_test.go index 16026b8..595c407 100644 --- a/fakedb_test.go +++ b/fakedb_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package sqlhook +package sqlhooks import ( "database/sql" diff --git a/sqlhook.go b/sqlhooks.go similarity index 99% rename from sqlhook.go rename to sqlhooks.go index db61fa5..dfe9a50 100644 --- a/sqlhook.go +++ b/sqlhooks.go @@ -1,4 +1,4 @@ -package sqlhook +package sqlhooks import ( "database/sql" diff --git a/sqlhook_test.go b/sqlhooks_test.go similarity index 99% rename from sqlhook_test.go rename to sqlhooks_test.go index c219cac..ec2f6ff 100644 --- a/sqlhook_test.go +++ b/sqlhooks_test.go @@ -1,4 +1,4 @@ -package sqlhook +package sqlhooks import ( "database/sql"