You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: sqinn.go
+29-29Lines changed: 29 additions & 29 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
/*
2
2
Package sqinn provides interface to SQLite databases in Go without cgo.
3
-
It uses Sqinn2 (https://github.com/cvilsmeier/sqinn2) for accessing SQLite
3
+
It uses Sqinn (https://github.com/cvilsmeier/sqinn) for accessing SQLite
4
4
databases. It is not a database/sql driver.
5
5
*/
6
6
package sqinn
@@ -23,11 +23,17 @@ import (
23
23
24
24
// Options for launching a sqinn instance.
25
25
typeOptionsstruct {
26
-
// Path to sqinn2 executable. Can be an absolute or relative path.
26
+
// Path to sqinn executable. Can be an absolute or relative path.
27
27
// The name ":prebuilt:" is a special name that uses an embedded prebuilt
28
-
// sqinn2 binary for linux/amd64 and windows/amd64.
28
+
// sqinn binary for linux/amd64 and windows/amd64.
29
29
// Default is ":prebuilt:".
30
-
Sqinn2string
30
+
Sqinnstring
31
+
32
+
// The database filename. It can be a file system path, e.g. "/tmp/test.db",
33
+
// or a special name like ":memory:".
34
+
// For further details, see https://www.sqlite.org/c3ref/open.html.
35
+
// Default is ":memory:".
36
+
Dbstring
31
37
32
38
// The loglevel. Can be 0 (off), 1 (info) or 2 (debug).
33
39
// Default is 0 (off).
@@ -42,17 +48,11 @@ type Options struct {
42
48
// Log can be nil, then nothing will be logged
43
49
// Default is nil.
44
50
Logfunc(msgstring)
45
-
46
-
// The database filename. It can be a file system path, e.g. "/tmp/test.db",
47
-
// or a special name like ":memory:".
48
-
// For further details, see https://www.sqlite.org/c3ref/open.html.
49
-
// Default is ":memory:".
50
-
Dbstring
51
51
}
52
52
53
53
// Prebuilt is a special path that tells sqinn-go to use an embedded
54
-
// pre-built sqinn2 binary. If Prebuilt is chosen, sqinn-go
55
-
// will extract sqinn2 into a temp directory and execute that.
54
+
// pre-built sqinn binary. If Prebuilt is chosen, sqinn-go
55
+
// will extract sqinn into a temp directory and execute that.
56
56
// Not all os/arch combinations are embedded, though.
57
57
// Currently we have linux/amd64 and windows/amd64.
58
58
constPrebuilt=":prebuilt:"
@@ -66,34 +66,34 @@ type Sqinn struct {
66
66
r*reader
67
67
}
68
68
69
-
//go:embed "prebuilt/linux/sqinn2"
69
+
//go:embed "prebuilt/linux/sqinn"
70
70
varprebuiltLinux []byte
71
71
72
-
//go:embed "prebuilt/windows/sqinn2.exe"
72
+
//go:embed "prebuilt/windows/sqinn.exe"
73
73
varprebuiltWindows []byte
74
74
75
-
// Launch launches a new sqinn2 subprocess. The [Options] specify
76
-
// the sqinn2 executable, the database name, and logging options.
75
+
// Launch launches a new sqinn subprocess. The [Options] specify
76
+
// the sqinn executable, the database name, and logging options.
77
77
// See [Options] for details.
78
78
// If an error occurs, it returns (nil, err).
79
79
funcLaunch(optOptions) (*Sqinn, error) {
80
-
ifopt.Sqinn2=="" {
81
-
opt.Sqinn2=Prebuilt
80
+
ifopt.Sqinn=="" {
81
+
opt.Sqinn=Prebuilt
82
82
}
83
83
vartempnamestring
84
-
ifopt.Sqinn2==Prebuilt {
84
+
ifopt.Sqinn==Prebuilt {
85
85
prebuiltMap:=map[string][]byte{
86
86
"linux/amd64": prebuiltLinux,
87
87
"windows/amd64": prebuiltWindows,
88
88
}
89
89
filenameMap:=map[string]string{
90
-
"linux": "sqinn2",
91
-
"windows": "sqinn2.exe",
90
+
"linux": "sqinn",
91
+
"windows": "sqinn.exe",
92
92
}
93
93
platform:=runtime.GOOS+"/"+runtime.GOARCH
94
94
prebuilt, prebuiltFound:=prebuiltMap[platform]
95
95
if!prebuiltFound {
96
-
returnnil, fmt.Errorf("no embedded prebuilt sqinn2 binary found for %s, please see https://github.com/cvilsmeier/sqinn2 for build instructions", platform)
96
+
returnnil, fmt.Errorf("no embedded prebuilt sqinn binary found for %s, please see https://github.com/cvilsmeier/sqinn for build instructions", platform)
0 commit comments