-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
executable file
·44 lines (35 loc) · 788 Bytes
/
Copy pathmain.go
File metadata and controls
executable file
·44 lines (35 loc) · 788 Bytes
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
package main
import (
"log"
"os"
"github.com/geovani-moc/gcommerce/migration"
"github.com/geovani-moc/gcommerce/actions"
)
func main() {
arguments := os.Args
if len(arguments) > 1 {
executeCommand(arguments[1:])
}
app := actions.BuildApp()
err := app.Run()
if err != nil {
log.Fatal(err)
}
}
func executeCommand(commands []string) {
for _, command := range commands {
switch command {
case "-m":
log.Println("Iniciando crição de tabelas ...")
err := migration.CreateAllTables()
if nil != err {
log.Println("Erro na criação de tabelas, ", err)
} else {
log.Println("Iniciando população de tabelas ...")
migration.PopulateAllTables(1000)
}
default:
log.Println("O comando \"", command, "\" não foi reconhecido.")
}
}
}