mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 11:10:57 +00:00
sort ControllerComments
This commit is contained in:
parent
cab8458c1c
commit
fc86f6422d
@ -55,6 +55,12 @@ type ControllerComments struct {
|
|||||||
MethodParams []*param.MethodParam
|
MethodParams []*param.MethodParam
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ControllerCommentsSlice []ControllerComments
|
||||||
|
|
||||||
|
func (p ControllerCommentsSlice) Len() int { return len(p) }
|
||||||
|
func (p ControllerCommentsSlice) Less(i, j int) bool { return p[i].Router < p[j].Router }
|
||||||
|
func (p ControllerCommentsSlice) Swap(i, j int) { p[i], p[j] = p[j], p[i] }
|
||||||
|
|
||||||
// Controller defines some basic http request handler operations, such as
|
// Controller defines some basic http request handler operations, such as
|
||||||
// http context, template and view, session and xsrf.
|
// http context, template and view, session and xsrf.
|
||||||
type Controller struct {
|
type Controller struct {
|
||||||
|
@ -274,6 +274,7 @@ func genRouterCode(pkgRealpath string) {
|
|||||||
sort.Strings(sortKey)
|
sort.Strings(sortKey)
|
||||||
for _, k := range sortKey {
|
for _, k := range sortKey {
|
||||||
cList := genInfoList[k]
|
cList := genInfoList[k]
|
||||||
|
sort.Sort(ControllerCommentsSlice(cList))
|
||||||
for _, c := range cList {
|
for _, c := range cList {
|
||||||
allmethod := "nil"
|
allmethod := "nil"
|
||||||
if len(c.AllowHTTPMethods) > 0 {
|
if len(c.AllowHTTPMethods) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user