代码拉取完成,页面将自动刷新
package proto_parser
import (
"fmt"
format "gitee.com/iotas/toolkit/proto_format"
"github.com/sirupsen/logrus"
"os"
"path"
"path/filepath"
"testing"
)
func TestCodeGen(t *testing.T) {
err := CodeGen(&CodeGenConfig{
PbFilePath: "./parser.proto",
OutputPath: ".",
GrpcOutputPath: "",
IncludePbFiles: nil,
OutputNeedFormat: false,
NoGetScopeFunc: false,
})
if err != nil {
panic(err)
}
}
func TestGormCodeGen(t *testing.T) {
err := CodeGen(&CodeGenConfig{
PbFilePath: "./parser.proto",
OutputPath: ".",
NoGetScopeFunc: false,
DbDriveType: "gdbc",
})
if err != nil {
logrus.Errorf("get err: %+v", err)
}
}
func TestAddApi(t *testing.T) {
err := AddAPI("./parser.proto", "TestService", "Find", "POST")
if err != nil {
panic(err)
}
}
func TestAddRPC(t *testing.T) {
err := AddRPC("router_group.proto", "MemberInfo", "Find")
if err != nil {
panic(err)
}
}
func TestOutputMD(t *testing.T) {
err := OutputMD("./parser.proto", "CSecRisk", "AutoCheck", []string{})
if err != nil {
panic(err)
}
}
func TestParseGoFile(t *testing.T) {
var ag = new(AstTree)
err := ag.parseGoFile("./freq_controller.go", "Freq", nil)
if err != nil {
panic(err)
}
//ag.checkAndGenerateRouteStruct()
}
func TestFsDir(t *testing.T) {
name := path.Base(path.Dir("./gen_to.go"))
fmt.Println(name)
if name == "." {
realPath, _ := os.Getwd()
fmt.Println(realPath)
fmt.Println(filepath.Base(realPath))
}
}
func TestFormat(t *testing.T) {
fmt.Println(format.Format("./model/parser.proto"))
}
func TestAddRoute(t *testing.T) {
err := AddRoute("./parser.proto", "TestService", "/api/test", "./internal/controller/test_controller.go")
if err != nil {
fmt.Println(err)
}
}
func TestAddSVC(t *testing.T) {
err := AddSvc("./parser.proto", "TestService", "./internal/services/test_service.go")
if err != nil {
fmt.Println(err)
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。