https://github.com/tarcisio-marinho/linq-go
Golang LINQ
https://github.com/tarcisio-marinho/linq-go
Last synced: 7 months ago
JSON representation
Golang LINQ
- Host: GitHub
- URL: https://github.com/tarcisio-marinho/linq-go
- Owner: tarcisio-marinho
- Created: 2022-09-04T23:41:00.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-09-05T13:16:29.000Z (about 3 years ago)
- Last Synced: 2025-01-19T06:47:07.526Z (9 months ago)
- Language: Go
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Golang LINQ
Golang version of .NET LINQ```go
package mainimport (
"fmt"
. "linq-go/Operations"
)type Car struct {
year int
owner, model string
}func main() {
cars := []Car{
{
year: 2016,
owner: "tarcisio",
model: "2",
}, {
year: 2018,
owner: "fernandinho",
model: "2",
}, {
year: 2022,
owner: "pedrinho",
model: "2",
},
{
year: 2017,
owner: "joaozinho",
model: "2",
},
}output := From(cars).Where(func(car Car) bool {
return car.year > 2016
}).Reverse().ToSlice()fmt.Println(output)
// [{2017 joaozinho 2} {2022 pedrinho 2} {2018 fernandinho 2}]
}
```