aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasuhiro Matsumoto <mattn.jp@gmail.com>2022-01-09 22:38:53 +0900
committermattn <mattn.jp@gmail.com>2022-01-10 23:30:33 +0900
commitc0fa5ea6d65d14f97f5a4570d157f3515ac8e7c2 (patch)
tree7338063f83c0bc35e9ca1eb0f12222830527e248
parentTemporary disable test for dropping vtable (diff)
downloadgolite-c0fa5ea6d65d14f97f5a4570d157f3515ac8e7c2.tar.gz
golite-c0fa5ea6d65d14f97f5a4570d157f3515ac8e7c2.tar.xz
Add driverName to be possible change driver name
-rw-r--r--sqlite3.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/sqlite3.go b/sqlite3.go
index 6ade8c9..31b2735 100644
--- a/sqlite3.go
+++ b/sqlite3.go
@@ -4,6 +4,7 @@
// Use of this source code is governed by an MIT-style
// license that can be found in the LICENSE file.
+//go:build cgo
// +build cgo
package sqlite3
@@ -233,8 +234,14 @@ const (
columnTimestamp string = "timestamp"
)
+// This variable can be replaced with -ldflags like below:
+// go build -ldflags="-X 'github.com/mattn/go-sqlite3.driverName=my-sqlite3'"
+var driverName = "sqlite3"
+
func init() {
- sql.Register("sqlite3", &SQLiteDriver{})
+ if driverName != "" {
+ sql.Register(driverName, &SQLiteDriver{})
+ }
}
// Version returns SQLite library version information.