Skip to content

Commit

Permalink
Add driverName to be possible change driver name
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed Jan 10, 2022
1 parent 98c5219 commit c0fa5ea
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion sqlite3.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit c0fa5ea

Please sign in to comment.