Browse Source

bug: add test

master
小黄 4 years ago
parent
commit
42e550f0fd
  1. 2
      servicegen/tpl/api_task.tpl
  2. 9
      servicegen/tpl/api_test.tpl

2
servicegen/tpl/api_task.tpl

@ -2,9 +2,7 @@ package hasaki_{{.app_name}}
import ( import (
"errors" "errors"
"fmt"
"git.ouxuan.net/hasaki-service/hasaki-service-ticker-task/hasaki_ticker_task" "git.ouxuan.net/hasaki-service/hasaki-service-ticker-task/hasaki_ticker_task"
"time"
) )
const TestTaskType = "test_task_type" const TestTaskType = "test_task_type"

9
servicegen/tpl/api_test.tpl

@ -1,16 +1,17 @@
package hasaki_{{.app_name}}
package hasaki_{{.app_name}}_test
import ( import (
"log" "log"
"testing" "testing"
"hasaki-service-{{.app_name}}/hasaki_{{.app_name}}"
"git.ouxuan.net/hasaki-service/hasaki-sdk/hskconfig" "git.ouxuan.net/hasaki-service/hasaki-sdk/hskconfig"
"git.ouxuan.net/hasaki-service/hasaki-sdk/hskdb" "git.ouxuan.net/hasaki-service/hasaki-sdk/hskdb"
) )
var branch interface{} = "branch_brand_63" var branch interface{} = "branch_brand_63"
var api *Api
var api hasaki_{{.app}}.*Api
func init() { func init() {
@ -18,8 +19,8 @@ func init() {
hskconfig.SetGolbalConfigFileName("E:\test.json") hskconfig.SetGolbalConfigFileName("E:\test.json")
hskdb.IsAsyncToXormSync2 = false hskdb.IsAsyncToXormSync2 = false
api = NewApi(hskdb.GetXormAuto(branch))
err := InitDbByConfig(branch)
api = hasaki_{{.app_name}}.NewApi(hskdb.GetXormAuto(branch))
err := hasaki_{{.app_name}}.InitDbByConfig(branch)
if err != nil { if err != nil {
log.Fatalln(err) log.Fatalln(err)
} }

Loading…
Cancel
Save