Skip to content

psarathi/go-linq

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

91 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A powerful language integrated query library for Go. Inspired by Microsoft's LINQ.

  • No dependencies: written in vanilla Go!
  • Tested: 100.0% code coverage on all stable releases.
  • Backwards compatibility: Your integration with the library will not be broken except major releases.

Installation

$ go get github.com/ahmetalpbalkan/go-linq

Quick Start

Example query: Find names of students over 18:

import . "github.com/ahmetalpbalkan/go-linq"
	
type Student struct {
    id, age int
    name string
}

over18Names, err := From(students)
	.Where(func (s T) (bool,error){
		return s.(*Student).age >= 18, nil
	})
	.Select(func (s T) (T,error){
		return s.(*Student).name, nil
	}).Results()

Documentation

Here is wiki:

  1. Install & Import
  2. Quickstart (Crash Course)
  3. Parallel LINQ
  4. Table of Query Functions
  5. Remarks & Notes
  6. FAQ

License

This software is distributed under Apache 2.0 License (see LICENSE for more).

Disclaimer

As noted in LICENSE, this library is distributed on an "as is" basis and author's employment association with Microsoft does not imply any sort of warranty or official representation the company. This is purely a personal side project developed on spare times.

Authors

Ahmet Alp Balkan@ahmetalpbalkan

Release Notes


v0.9-rc4
* GroupBy()

v0.9-rc3.2
* bugfix: All() iterating over values instead of indices

v0.9-rc3.1
* bugfix: modifying result slice affects subsequent query methods

v0.9-rc3
* removed FirstOrNil, LastOrNil, ElementAtOrNil methods 

v0.9-rc2.5
* slice-accepting methods accept slices of any type with reflections

v0.9-rc2
* parallel linq (plinq) implemented
* Queryable separated into Query & ParallelQuery
* fixed early termination for All

v0.9-rc1
* many linq methods are implemented
* methods have error handling support
* type assertion limitations are unresolved
* travis-ci.org build integrated
* open sourced on github, master & dev branches

About

.NET LINQ-like query methods for Go

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%