forked from YaoApp/yao
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
50 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var helpCmd = &cobra.Command{ | ||
Use: "help", | ||
Short: "显示命令帮助文档", | ||
Long: `显示命令帮助文档`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
cmd.Help() | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package global | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/yaoapp/gou" | ||
) | ||
|
||
var cfg Config | ||
|
||
func TestMain(m *testing.M) { | ||
|
||
// Run test suites | ||
exitVal := m.Run() | ||
|
||
// we can do clean up code here | ||
gou.KillPlugins() | ||
|
||
os.Exit(exitVal) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,10 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/yaoapp/gou" | ||
"github.com/yaoapp/kun/utils" | ||
"github.com/yaoapp/xiang/cmd" | ||
) | ||
|
||
// 主程序 | ||
func main() { | ||
cmd.Execute() | ||
|
||
// fmt.Printf("象传应用引擎 %s %s\n", VERSION, DOMAIN) | ||
// cfg := NewConfig() | ||
|
||
// // 加载脚本 | ||
// capsule.AddConn("primary", "mysql", cfg.Database.Primary[0]).SetAsGlobal() | ||
|
||
// // 加密密钥 | ||
// gou.LoadCrypt(fmt.Sprintf(`{"key":"%s"}`, cfg.Database.AESKey), "AES") | ||
// gou.LoadCrypt(`{}`, "PASSWORD") | ||
|
||
// // 加载模型 | ||
// Load(cfg) | ||
|
||
// // 启动服务 | ||
// for _, api := range gou.APIs { | ||
// for _, p := range api.HTTP.Paths { | ||
// utils.Dump(api.Name + ":" + p.Path) | ||
// } | ||
|
||
// } | ||
// gou.ServeHTTP(gou.Server{ | ||
// Host: cfg.Service.Host, | ||
// Port: cfg.Service.Port, | ||
// Allows: cfg.Service.Allow, | ||
// Root: "/api", | ||
// }) | ||
} | ||
|
||
// Migrate 数据迁移 | ||
func Migrate() { | ||
for name, mod := range gou.Models { | ||
utils.Dump(name) | ||
mod.Migrate(true) | ||
} | ||
} |