-
Notifications
You must be signed in to change notification settings - Fork 117
/
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/ClickHouse/clickhouse-go"
_ "github.com/SAP/go-hdb/driver"
_ "github.com/denisenkom/go-mssqldb"
_ "github.com/go-sql-driver/mysql"
_ "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
}
}