-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (43 loc) · 1.12 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"fmt"
"github.com/percona/go-mysql/query"
"os"
"runtime"
"strings"
)
const (
GoOSWindows = "windows"
GoOSLinux = "linux"
)
func main() {
if len(os.Args) <= 1 {
if runtime.GOOS == GoOSLinux {
fmt.Println("请输入 sql ,多个 sql 用空格分开\n" +
"例:\n" +
"./sql-fingerprint 'select * from table where id=1' 'select * from table where id=2'" +
"\n" +
"\n" +
"Please enter sql, multiple sql separated by spaces\n" +
"For example:\n" +
"./sql-fingerprint 'select * from table where id=1' 'select * from table where id=2'")
}
if runtime.GOOS == GoOSWindows {
fmt.Println("请输入 sql ,多个 sql 用空格分开\n" +
"例:\n" +
"sql-fingerprint.exe 'select * from table where id=1' 'select * from table where id=2'" +
"\n" +
"\n" +
"Please enter sql, multiple sql separated by spaces\n" +
"For example:\n" +
"sql-fingerprint.exe 'select * from table where id=1' 'select * from table where id=2'")
}
return
}
for k, v := range os.Args {
if k == 0 {
continue
}
fmt.Println(strings.TrimSpace(query.Fingerprint(v)))
}
}