Implement more endpoints & overhaul [2/n]
Drop LevelDB and move all the things to SQLite. Implemented endpoints: /api <unit, accessoryMaterialAll> /api <unit, accessoryTab> /live/continue /live/partyList /unit/favoriteAccessory (WIP) /unit/sale Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
@@ -1,15 +1,11 @@
|
||||
package db
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
_ "modernc.org/sqlite"
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
var (
|
||||
Ldb *LdbInstance
|
||||
|
||||
MainDb = "assets/main.db"
|
||||
UserDb = "assets/data.db"
|
||||
MainEng *xorm.Engine
|
||||
@@ -17,8 +13,6 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
Ldb = GetLdbInstance()
|
||||
|
||||
eng, err := xorm.NewEngine("sqlite", MainDb)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -43,13 +37,3 @@ func init() {
|
||||
eng.SetMaxIdleConns(5)
|
||||
UserEng = eng
|
||||
}
|
||||
|
||||
func MatchTokenUid(token, uid string) bool {
|
||||
res, err := Ldb.Get([]byte(uid))
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return false
|
||||
}
|
||||
|
||||
return string(res) == token
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user