1
0
mirror of https://github.com/beego/bee.git synced 2024-12-22 20:20:49 +00:00

Merge pull request #276 from ZetaChow/develop

Develop
This commit is contained in:
astaxie 2016-09-09 15:52:22 +08:00 committed by GitHub
commit e296e96e70
3 changed files with 32 additions and 13 deletions

View File

@ -650,7 +650,8 @@ func checkEnv(appname string) (apppath, packpath string, err error) {
for _, gpath := range gps {
gsrcpath := path.Join(gpath, "src")
if strings.HasPrefix(currpath, gsrcpath) {
return currpath, currpath[len(gsrcpath)+1:], nil
packpath = strings.Replace(currpath[len(gsrcpath)+1:], string(path.Separator), "/", -1)
return currpath, packpath, nil
}
}

View File

@ -1168,11 +1168,12 @@ import (
"github.com/astaxie/beego"
)
// oprations for {{ctrlName}}
// {{ctrlName}}Controller oprations for {{ctrlName}}
type {{ctrlName}}Controller struct {
beego.Controller
}
// URLMapping ...
func (c *{{ctrlName}}Controller) URLMapping() {
c.Mapping("Post", c.Post)
c.Mapping("GetOne", c.GetOne)
@ -1181,6 +1182,7 @@ func (c *{{ctrlName}}Controller) URLMapping() {
c.Mapping("Delete", c.Delete)
}
// Post ...
// @Title Post
// @Description create {{ctrlName}}
// @Param body body models.{{ctrlName}} true "body for {{ctrlName}} content"
@ -1202,7 +1204,8 @@ func (c *{{ctrlName}}Controller) Post() {
c.ServeJSON()
}
// @Title Get
// GetOne ...
// @Title Get One
// @Description get {{ctrlName}} by id
// @Param id path string true "The key for staticblock"
// @Success 200 {object} models.{{ctrlName}}
@ -1220,6 +1223,7 @@ func (c *{{ctrlName}}Controller) GetOne() {
c.ServeJSON()
}
// GetAll ...
// @Title Get All
// @Description get {{ctrlName}}
// @Param query query string false "Filter. e.g. col1:v1,col2:v2 ..."
@ -1235,9 +1239,9 @@ func (c *{{ctrlName}}Controller) GetAll() {
var fields []string
var sortby []string
var order []string
var query map[string]string = make(map[string]string)
var query = make(map[string]string)
var limit int64 = 10
var offset int64 = 0
var offset int64
// fields: col1,col2,entity.col3
if v := c.GetString("fields"); v != "" {
@ -1282,7 +1286,8 @@ func (c *{{ctrlName}}Controller) GetAll() {
c.ServeJSON()
}
// @Title Update
// Put ...
// @Title Put
// @Description update the {{ctrlName}}
// @Param id path string true "The id you want to update"
// @Param body body models.{{ctrlName}} true "body for {{ctrlName}} content"
@ -1305,6 +1310,7 @@ func (c *{{ctrlName}}Controller) Put() {
c.ServeJSON()
}
// Delete ...
// @Title Delete
// @Description delete the {{ctrlName}}
// @Param id path string true "The id you want to delete"

View File

@ -82,11 +82,12 @@ import (
"github.com/astaxie/beego"
)
// operations for {{controllerName}}
// {{controllerName}}Controller operations for {{controllerName}}
type {{controllerName}}Controller struct {
beego.Controller
}
// URLMapping ...
func (c *{{controllerName}}Controller) URLMapping() {
c.Mapping("Post", c.Post)
c.Mapping("GetOne", c.GetOne)
@ -95,6 +96,7 @@ func (c *{{controllerName}}Controller) URLMapping() {
c.Mapping("Delete", c.Delete)
}
// Post ...
// @Title Create
// @Description create {{controllerName}}
// @Param body body models.{{controllerName}} true "body for {{controllerName}} content"
@ -105,6 +107,7 @@ func (c *{{controllerName}}Controller) Post() {
}
// GetOne ...
// @Title GetOne
// @Description get {{controllerName}} by id
// @Param id path string true "The key for staticblock"
@ -115,6 +118,7 @@ func (c *{{controllerName}}Controller) GetOne() {
}
// GetAll ...
// @Title GetAll
// @Description get {{controllerName}}
// @Param query query string false "Filter. e.g. col1:v1,col2:v2 ..."
@ -130,7 +134,8 @@ func (c *{{controllerName}}Controller) GetAll() {
}
// @Title Update
// Put ...
// @Title Put
// @Description update the {{controllerName}}
// @Param id path string true "The id you want to update"
// @Param body body models.{{controllerName}} true "body for {{controllerName}} content"
@ -141,6 +146,7 @@ func (c *{{controllerName}}Controller) Put() {
}
// Delete ...
// @Title Delete
// @Description delete the {{controllerName}}
// @Param id path string true "The id you want to delete"
@ -164,11 +170,12 @@ import (
"github.com/astaxie/beego"
)
// oprations for {{controllerName}}
// {{controllerName}}Controller oprations for {{controllerName}}
type {{controllerName}}Controller struct {
beego.Controller
}
// URLMapping ...
func (c *{{controllerName}}Controller) URLMapping() {
c.Mapping("Post", c.Post)
c.Mapping("GetOne", c.GetOne)
@ -177,6 +184,7 @@ func (c *{{controllerName}}Controller) URLMapping() {
c.Mapping("Delete", c.Delete)
}
// Post ...
// @Title Post
// @Description create {{controllerName}}
// @Param body body models.{{controllerName}} true "body for {{controllerName}} content"
@ -195,7 +203,8 @@ func (c *{{controllerName}}Controller) Post() {
c.ServeJSON()
}
// @Title Get
// GetOne ...
// @Title Get One
// @Description get {{controllerName}} by id
// @Param id path string true "The key for staticblock"
// @Success 200 {object} models.{{controllerName}}
@ -213,6 +222,7 @@ func (c *{{controllerName}}Controller) GetOne() {
c.ServeJSON()
}
// GetAll ...
// @Title Get All
// @Description get {{controllerName}}
// @Param query query string false "Filter. e.g. col1:v1,col2:v2 ..."
@ -228,9 +238,9 @@ func (c *{{controllerName}}Controller) GetAll() {
var fields []string
var sortby []string
var order []string
var query map[string]string = make(map[string]string)
var query = make(map[string]string)
var limit int64 = 10
var offset int64 = 0
var offset int64
// fields: col1,col2,entity.col3
if v := c.GetString("fields"); v != "" {
@ -275,7 +285,8 @@ func (c *{{controllerName}}Controller) GetAll() {
c.ServeJSON()
}
// @Title Update
// Put ...
// @Title Put
// @Description update the {{controllerName}}
// @Param id path string true "The id you want to update"
// @Param body body models.{{controllerName}} true "body for {{controllerName}} content"
@ -295,6 +306,7 @@ func (c *{{controllerName}}Controller) Put() {
c.ServeJSON()
}
// Delete ...
// @Title Delete
// @Description delete the {{controllerName}}
// @Param id path string true "The id you want to delete"