【文件属性】:
文件名称:sortx:按结构中的字段排序
文件大小:3KB
文件格式:ZIP
更新时间:2021-07-01 03:18:33
Go
排序
Sortx 是一个简单的 golang 排序扩展,它提供了一种按字段对结构数组进行排序的方法。
安装:
go get github.com/joyt/sortx
例子:
import (
"time"
"github.com/joyt/sortx"
)
type Person struct {
Name string
Age int
BirthDate time. Time
Married bool
Popularity float64
}
func main () {
people := [] Person {
{ Name : "Santa Claus" , Age : 424 , BirthDate : time . Date ( 1590 , 12 , 25 , 0 , 0 , 0 , 0 , time . Local ()), Married :
【文件预览】:
sortx-master
----.gitignore(266B)
----sort_test.go(1KB)
----sort.go(4KB)
----README.md(1KB)