-
Notifications
You must be signed in to change notification settings - Fork 6
/
hospital.go
72 lines (66 loc) · 1.3 KB
/
hospital.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"fmt"
"hospital/server"
"hospital/storage"
"hospital/surgeon"
"log"
"os"
_ "github.com/golang-migrate/migrate/v4/source/file"
_ "github.com/lib/pq"
"github.com/urfave/cli"
)
var app = cli.NewApp()
func info() {
app.Name = "Hospital - An autonomous healing System"
app.Usage = "fix fault/failure in system"
app.Author = "Jainam | Dilip"
app.Version = "1.0.0"
}
func commands() {
app.Commands = []cli.Command{
{
Name: "runserver",
Aliases: []string{"s"},
Usage: "Starts the server",
Action: func(c *cli.Context) {
server.StartServer()
},
},
{
Name: "migrate",
Aliases: []string{"m"},
Usage: "Database migration",
Action: func(c *cli.Context) {
storage.Migration()
fmt.Println("Migrating...")
},
},
{
Name: "downonestep",
Aliases: []string{"dw1"},
Usage: "Database roll back",
Action: func(c *cli.Context) {
storage.DownOneStep()
fmt.Println("Version Rolled back by 1 step...")
},
},
{
Name: "startsurgeon",
Aliases: []string{"surgeon"},
Usage: "Surgeon starts long polling",
Action: func(c *cli.Context) {
fmt.Println("Started Surgeon...")
surgeon.LongPolling()
},
},
}
}
func main() {
info()
commands()
err := app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}