←back to thread

201 points olvy0 | 1 comments | | HN request time: 0.203s | source
Show context
dingdingdang ◴[] No.41878617[source]
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?

replies(4): >>41878718 #>>41878734 #>>41878990 #>>41879319 #
1. pjc50 ◴[] No.41878734[source]
> 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.