测试demo调整

This commit is contained in:
hoteas 2021-05-22 04:52:03 +08:00
parent 91dc207a78
commit babf6595ee
4 changed files with 17 additions and 16 deletions

View File

@ -1,8 +1,9 @@
package main package main
import ( import (
"code.hoteas.com/golang/hotime" "../../hotime"
"code.hoteas.com/golang/hotime/tools/db" "../tools/db"
"database/sql"
"fmt" "fmt"
//"go.hoteas.com/hotime/cache" //"go.hoteas.com/hotime/cache"
"golang.org/x/net/websocket" "golang.org/x/net/websocket"
@ -51,15 +52,15 @@ func main() {
appIns.SetCache(hotime.CacheIns(&hotime.CacheMemory{})) appIns.SetCache(hotime.CacheIns(&hotime.CacheMemory{}))
//快捷模式 //快捷模式
//appIns.SetDefault(func(err ...*hotime.Error) *sql.DB { appIns.SetDefault(func(err ...*hotime.Error) *sql.DB {
// query := appIns.Config.GetString("dbUser") + ":" + appIns.Config.GetString("dbPwd") + query := appIns.Config.GetString("dbUser") + ":" + appIns.Config.GetString("dbPwd") +
// "@tcp(" + appIns.Config.GetString("dbHost") + ":" + appIns.Config.GetString("dbPort") + ")/" + appIns.Config.GetString("dbName") + "?charset=utf8" "@tcp(" + appIns.Config.GetString("dbHost") + ":" + appIns.Config.GetString("dbPort") + ")/" + appIns.Config.GetString("dbName") + "?charset=utf8"
// DB, e := sql.Open("mysql", query) DB, e := sql.Open("mysql", query)
// if e != nil && len(err) != 0 { if e != nil && len(err) != 0 {
// err[0].SetError(e) err[0].SetError(e)
// } }
// return DB return DB
//}) })
appIns.Run(hotime.Router{ appIns.Run(hotime.Router{
"app": hotime.Proj{ "app": hotime.Proj{

View File

@ -1,9 +1,9 @@
package db package db
import ( import (
"code.hoteas.com/golang/hotime" "../../../hotime"
"code.hoteas.com/golang/hotime/tools/mysql" "../mysql"
"code.hoteas.com/golang/hotime/tools/sqlite" "../sqlite"
"strings" "strings"
) )

View File

@ -1,7 +1,7 @@
package mysql package mysql
import ( import (
"code.hoteas.com/golang/hotime" "../../../hotime"
"database/sql" "database/sql"
_ "github.com/go-sql-driver/mysql" _ "github.com/go-sql-driver/mysql"
) )

View File

@ -1,7 +1,7 @@
package sqlite package sqlite
import ( import (
"code.hoteas.com/golang/hotime" "../../../hotime"
"database/sql" "database/sql"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
) )