-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
55 lines (46 loc) · 1.04 KB
/
main.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
package main
import (
"database/sql"
"fmt"
"log"
// "os"
// "encoding/json"
// Import sqlite3
_ "github.com/mattn/go-sqlite3"
)
var db *sql.DB
var err error
type User struct {
Rollno int `json:"rollno"`
Name string `json:"name"`
Coin int `json:"coin"`
Password string `json:"password"`
Role string `json:"role"`
Activity int `json:"activity"`
}
func main() {
//For testing purpose only
// os.Remove("students.db")
//Create Database
db, err = sql.Open("sqlite3", "./students.db")
if err != nil {
log.Fatal(err)
}
// TODO: Learn why you need this
defer db.Close()
//Create table
err = createTable()
if err != nil {
log.Fatal(err)
}
// display current information
fmt.Println("===--------------User List--------------===")
displayStudents()
fmt.Println("===--------------Award History-------------===")
displayAward()
fmt.Println("===--------------Transfer History-------------===")
displayTransfer()
fmt.Println("===-----------------Here you go---------------===")
// Start Server
startServer()
}