go-linq is a Go library that lets you query and transform collections of data using method chaining, similar to how SQL queries work but written directly in Go code. The concept comes from .NET, where LINQ (Language Integrated Query) lets developers filter, sort, group, and reshape lists of objects using a readable chain of operations instead of writing manual loops. With go-linq, you start from a collection such as a slice, a map, a string, or a channel, then chain operations: filter items with a condition, pick specific fields, sort, group, or combine with other collections. The library uses lazy evaluation, meaning it only processes items as they are consumed rather than building intermediate lists in memory. The library requires no external dependencies and is safe for use across multiple goroutines at the same time. It works with any Go data types through interface parameters, and also offers a set of generic-style methods with a "T" suffix, such as WhereT and SelectT, that accept typed functions for cleaner code. These typed methods use reflection internally and are slower than the standard methods, but they remove the need to write type assertions throughout your code. Version 4 adopted Go's standard iterator pattern, adding typed constructor functions for each collection kind: FromSlice, FromMap, FromChannel, FromString, and more. These avoid the overhead of reflection for common cases. Earlier constructor functions remain available for backward compatibility. The README includes several worked examples: filtering cars by manufacturing year, finding the author who wrote the most books, counting word frequencies across sentences, and implementing a custom query method by extending the library's Query type.
← ahmetb on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.