1 Star 0 Fork 0

xiaos/echo_demo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ref.go 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
肖申 提交于 2018-04-08 18:11 . fc
package main
import (
"fmt"
"github.com/labstack/echo"
"github.com/labstack/echo/middleware"
"xiaos.com/echo_demo/model"
)
type Data struct {
DataName string
DataOp string
DataContent map[string]interface{}
Query map[string]interface{}
SortBy map[string]interface{}
Select map[string]interface{}
Limit int
Offset int
Schema map[string]interface{}
}
func (data *Data)Debug() {
}
func (data *Data)Exec(){
}
var DataMapRef map[string]interface{}
func init(){
fmt.Printf("init")
DataMapRef = make(map[string]interface{})
DataMapRef["user"] = new(model.User)
}
func logAng(v interface{}){
fmt.Printf("%v\n",v)
}
func main() {
e := echo.New()
e.Use(middleware.Logger())
e.Use(middleware.Recover())
e.POST("/data/:data_name/:op_name", func(c echo.Context) error {
data_name := c.Param("data_name")
op_name := c.Param("op_name")
fmt.Printf(data_name+op_name)
data_model := DataMapRef[data_name]
logAng(data_model)
p := data_model.(*model.User)
logAng(*p)
return c.JSON(200,"")
})
e.Logger.Fatal(e.Start(":8082"))
//save data_name op save_data
//update data_name op query update_data
//delete data_name op query
//find data_name op query select sort limit offset
//count data_name op query
//todo
//group_by sum max min count
//join
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/lambdaxs/echo_demo.git
git@gitee.com:lambdaxs/echo_demo.git
lambdaxs
echo_demo
echo_demo
master

搜索帮助