Add example using driverName

This commit is contained in:
Yasuhiro Matsumoto 2022-01-09 22:39:48 +09:00 committed by mattn
parent c0fa5ea6d6
commit 671e666c2e
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,12 @@
TARGET = custom_driver_name
ifeq ($(OS),Windows_NT)
TARGET := $(TARGET).exe
endif
all : $(TARGET)
$(TARGET) : main.go
go build -ldflags="-X 'github.com/mattn/go-sqlite3.driverName=my-sqlite3'"
clean :
rm -f $(TARGET)

View File

@ -0,0 +1,13 @@
package main
import (
"database/sql"
_ "github.com/mattn/go-sqlite3"
)
func main() {
for _, driver := range sql.Drivers() {
println(driver)
}
}