feat(Go-Tool):2020/11/12:新增linq包使用示例(未完成)

This commit is contained in:
Huangzj
2020-11-12 18:10:15 +08:00
parent 3616c4b5e5
commit 2ac2b2666f
33 changed files with 2517 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
/*
* @Author : huangzj
* @Time : 2020/11/12 14:43
* @Description:测试方法集合
*/
package linqUse
import "time"
//书籍发布时间是否早于--.--.--
var PublishTimeBeforeFunc = func(thisBook interface{}) bool {
if thisBook.(Book).PublishTime.Before(time.Date(2020, 1, 1, 0, 0, 0, 0, time.Local)) {
return true
}
return false
}
//书籍发布时间是否晚于--.--.--
var PublishTimeAfterFunc = func(thisBook interface{}) bool {
if thisBook.(Book).PublishTime.After(time.Date(2018, 1, 1, 0, 0, 0, 0, time.Local)) {
return true
}
return false
}
//书籍发布时间是否晚于--.--.--
var PublishTimeAfterFunc2 = func(thisBook interface{}) bool {
if thisBook.(Book).PublishTime.After(time.Date(2021, 1, 1, 0, 0, 0, 0, time.Local)) {
return true
}
return false
}
//自定义聚合操作方法
var AggregateFunc = func(first interface{}, second interface{}) interface{} {
if first.(Book).PublishTime.Before(second.(*Book).PublishTime) {
return first
}
return second
}