具有日期的Golang排序结构片段,没有辅助数据结构

时间:2019-07-17 21:11:51

标签: go time

给出下面的结构

type SortDateExample struct {
    sortByThis time.Time
    id string
}    

然后切片初始化了

之类的东西
var datearray = var alerts = make([]SortDateExample, 0)
dateSlice = append(dateSlice,newSortDateExmple)
dateSlice = append(dateSlice,newSortDateExmple2)
dateSlice = append(dateSlice,newSortDateExmple3)

在golang 1.12中,我可以在不建立辅助数据结构的情况下对该数组进行排序吗? 例如此问题Sorting by time.Time in Golang中显示的内容?

0 个答案:

没有答案
相关问题