Browse Source

Boototstraping

William Wiechorek 6 years ago
parent
commit
519cc572bc
5 changed files with 7 additions and 8 deletions
  1. 3 0
      .gometalinter
  2. BIN
      build
  3. 0 1
      config.go
  4. 0 3
      config/config.go
  5. 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
+}

BIN
build


+ 0 - 1
config.go

1
 package main
1
 package main
2
 
2
 
3
-//ServerPort para escuta do servidor
4
 const SERVER_PORT = 8080
3
 const SERVER_PORT = 8080

+ 0 - 3
config/config.go

1
-package config
2
-
3
-const SERVER_PORT = 8080

+ 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