Skip to content

Commit 671e666

Browse files
committed
Add example using driverName
1 parent c0fa5ea commit 671e666

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

_example/custom_driver_name/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
TARGET = custom_driver_name
2+
ifeq ($(OS),Windows_NT)
3+
TARGET := $(TARGET).exe
4+
endif
5+
6+
all : $(TARGET)
7+
8+
$(TARGET) : main.go
9+
go build -ldflags="-X 'github.com/mattn/go-sqlite3.driverName=my-sqlite3'"
10+
11+
clean :
12+
rm -f $(TARGET)

_example/custom_driver_name/main.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
import (
4+
"database/sql"
5+
6+
_ "github.com/mattn/go-sqlite3"
7+
)
8+
9+
func main() {
10+
for _, driver := range sql.Drivers() {
11+
println(driver)
12+
}
13+
}

0 commit comments

Comments
 (0)