forked from alash3al/sqler
-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.go
50 lines (43 loc) · 1.02 KB
/
init.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
49
50
// Copyright 2018 The SQLer Authors. All rights reserved.
// Use of this source code is governed by a Apache 2.0
// license that can be found in the LICENSE file.
package main
import (
"flag"
"fmt"
"os"
"runtime"
_ "github.com/SAP/go-hdb/driver"
_ "github.com/denisenkom/go-mssqldb"
_ "github.com/go-sql-driver/mysql"
_ "github.com/kshvakov/clickhouse"
_ "github.com/lib/pq"
_ "github.com/mattn/go-sqlite3"
"github.com/alash3al/go-color"
"github.com/jmoiron/sqlx"
)
func init() {
usage := flag.Usage
flag.Usage = func() {
fmt.Println(color.MagentaString(sqlerBrand))
usage()
}
flag.Parse()
runtime.GOMAXPROCS(*flagWorkers)
{
tstconn, err := sqlx.Connect(*flagDBDriver, *flagDBDSN)
if err != nil {
fmt.Println(color.RedString("[%s] %s - connection error - (%s)", *flagDBDriver, *flagDBDSN, err.Error()))
os.Exit(0)
}
tstconn.Close()
}
{
manager, err := NewManager(*flagAPIFile)
if err != nil {
fmt.Println(color.RedString("(%s)", err.Error()))
os.Exit(0)
}
macrosManager = manager
}
}