Data types
This commit is contained in:
31
main.go
31
main.go
@@ -4,6 +4,37 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// define global db
|
||||||
|
var db, _ = sql.Open("sqlite3", "./database/data.db")
|
||||||
|
|
||||||
|
// types representing json queries
|
||||||
|
|
||||||
|
type loginInput struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type loginOutput struct {
|
||||||
|
UID string `json:"uid"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
Role string `json:"role"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type task struct {
|
||||||
|
TID string `json:"tid"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Points int `json:"points"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type historyData struct {
|
||||||
|
UID string `json:"uid"`
|
||||||
|
TID string `json:"tid"`
|
||||||
|
Time string `json:"time"`
|
||||||
|
PointsGained int `json:"pointsGained"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// log the user into their account
|
||||||
func login(c *gin.Context) {
|
func login(c *gin.Context) {
|
||||||
// log the user into their account
|
// log the user into their account
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user