1 Star 0 Fork 0

zhuchance / kubernetes

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
param_sorter.go 647 Bytes
一键复制 编辑 原始数据 按行查看 历史
package swagger
// Copyright 2014 Ernest Micklei. All rights reserved.
// Use of this source code is governed by a license
// that can be found in the LICENSE file.
type ParameterSorter []Parameter
func (s ParameterSorter) Len() int {
return len(s)
}
func (s ParameterSorter) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
var typeToSortKey = map[string]string{
"path": "A",
"query": "B",
"form": "C",
"header": "D",
"body": "E",
}
func (s ParameterSorter) Less(i, j int) bool {
// use ordering path,query,form,header,body
pi := s[i]
pj := s[j]
return typeToSortKey[pi.ParamType]+pi.Name < typeToSortKey[pj.ParamType]+pj.Name
}
Go
1
https://gitee.com/meoom/kubernetes.git
git@gitee.com:meoom/kubernetes.git
meoom
kubernetes
kubernetes
v0.6.1

搜索帮助