intimate_view/goserver/main.go
2020-08-31 18:10:38 +08:00

54 lines
1.0 KiB
Go

package main
import (
"database/sql"
"time"
"github.com/gin-gonic/gin"
_ "github.com/go-sql-driver/mysql"
)
var StoreStreamer *sql.DB
func init() {
db, err := sql.Open("mysql", InitConfig.Database.ExtractorURI)
if err != nil {
panic(err)
}
StoreStreamer = db
}
type Result struct {
Code int
Error string
Data interface{}
}
type ObjectQuery struct {
Uid int64
Platform string
UserId string
UserName string
LiveUrl string
Tags []string
Followers int64
Views int64
Gratuity int64
LiveTitle string
LiveStartTime *time.Time
LiveEndTime *time.Time
UpdateTime *time.Time
}
func main() {
engine := gin.New() //r := gin.Default() //使用默认中间件
engine.Use(gin.Logger())
engine.Use(Cors())
engine.GET("twitcasting/query", TwitcastingQuery)
engine.GET("openrec/query", OpenrecQuery)
engine.GET("twitch/query", TwitchQuery)
engine.GET("tag/count", CountTag)
engine.GET("tag/allcount", CountTag)
engine.Run(":5500")
}