Hacker News new | past | comments | ask | show | jobs | submit login

OK, so since I've never actually bothered to look at what LINQ actually is.. there may be others in the same boat: "LINQ allows you to query any enumerable collections such as List<T>, Array, or Dictionary<TKey,TValue>.". Got to admit I still find the LINQ to DB passtru rather opaque even after reading up on it: https://stackoverflow.com/questions/30716776/passing-a-query...

Basically allowing for a uniform way to query data which is reminiscent of a more modern version of SQL (in my optics anyway). Does anything library wise come close to this within the Golang ecosystem?






While LINQ does include a library of extension methods for functional programming with .NET collections (which is great), it also includes "Expression Classes". In a nutshell, this allows a user to pass a single expression lambda to a function, and the function implementor receives the abstract syntax tree for the lambda, not the lambda itself. You can then not only receive and analyze these trees, you can also manually build and compile them. This effectively allows a limited set of runtime macros within .NET.

> Basically allowing for a uniform way to query data which is reminiscent of a more modern version of SQL.

Pretty much. There's the "language integrated" version which looks a lot like SQL:

    var foo = new List<int> { 1, 2, 3, };
    var response = from x in foo where x > 1 select x.ToString();
But that just translates to the method-orientated one which many people prefer

    response = foo.Where(x => x > 1).Select(x => x.ToString());
If instead of querying a List or Dictionary you query a database, using an ORM (usually Entity Framework), that will actually get converted to SQL and run on the DB.

> Basically allowing for a uniform way to query data which is reminiscent of a more modern version of SQL (in my optics anyway)

It's more general and reusable than SQL, so you can map a subset of it to SQL, which is what some object-relational mappers do.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: