Matheus 6 gadi atpakaļ
vecāks
revīzija
90dc110056
2 mainītis faili ar 7 papildinājumiem un 4 dzēšanām
  1. 3 0
      .gometalinter
  2. 4 4
      core/database/database.go

+ 3 - 0
.gometalinter

1
+{
2
+  "Exclude": ["exported \\w+ (\\S*['.]*)([a-zA-Z'.*]*) should have comment or be unexported"]
3
+}

+ 4 - 4
core/database/database.go

1
-package models
1
+package database
2
 
2
 
3
 import (
3
 import (
4
 	"database/sql"
4
 	"database/sql"
7
 	_ "github.com/go-sql-driver/mysql"
7
 	_ "github.com/go-sql-driver/mysql"
8
 )
8
 )
9
 
9
 
10
-var db *sql.DB
10
+var DB *sql.DB
11
 
11
 
12
 func Init(dataSourceName string) error {
12
 func Init(dataSourceName string) error {
13
 
13
 
14
 	var err error
14
 	var err error
15
 
15
 
16
-	db, err = sql.Open("mysql", dataSourceName)
16
+	DB, err = sql.Open("mysql", dataSourceName)
17
 
17
 
18
 	if err != nil {
18
 	if err != nil {
19
 		log.Panic(err)
19
 		log.Panic(err)
20
 	}
20
 	}
21
 
21
 
22
-	if err = db.Ping(); err != nil {
22
+	if err = DB.Ping(); err != nil {
23
 		log.Panic(err)
23
 		log.Panic(err)
24
 	}
24
 	}
25
 
25