feat(Go-Tool):2020/12/14:添加validator.v8源码解析和使用示例

This commit is contained in:
Huangzj
2020-12-14 15:15:58 +08:00
parent 23d7d6e226
commit fa31b23cca
51 changed files with 4619 additions and 1662 deletions
@@ -0,0 +1,36 @@
/*
* @Author : huangzj
* @Time : 2020/12/2 15:39
* @Description
*/
package testHeap
type Person struct {
Name string //名字
Age int //年龄
Money float64 //身价
}
type heapTool []*Person
func (h *heapTool) Less(i, j int) bool {
return (*h)[i].Age < (*h)[j].Age
}
func (h *heapTool) Swap(i, j int) {
(*h)[i], (*h)[j] = (*h)[j], (*h)[i]
}
func (h *heapTool) Len() int {
return len(*h)
}
func (h *heapTool) Pop() (v interface{}) {
*h, v = (*h)[:h.Len()-1], (*h)[h.Len()-1]
return
}
func (h *heapTool) Push(v interface{}) {
*h = append(*h, v.(*Person))
}