sqlc-dev / sqlc

Generate type-safe code from SQL
https://sqlc.dev
MIT License
12.35k stars 782 forks source link

Add Ruby support #3390

Closed doron050 closed 2 months ago

doron050 commented 4 months ago

The ruby ecosystem is very much alive, you can see it in Ruby 2023 ecosystem report by Jetbrains, and as a developer and an SQLC user, I think the project can benefit by supporting as many language runtimes as possible + if there is Python, why not Ruby? :)

@SockworkOrange and I are close to releasing the 1st (though mature) version of our C# plugin, and we want to start working on a ruby one.

SockworkOrange commented 3 months ago

Considering this comment on the corresponding C# issue - "if someone would like to try their hand at C# support, you aren't blocked getting your changes into the sqlc codebase"

@doron050 and I have also started working on adding Ruby support (implemented in Ruby) in here - https://github.com/DaredevilOSS/sqlc-gen-ruby

kyleconroy commented 3 months ago

Really excited to see this one happen as well. I was going to use https://github.com/jeremyevans/sequel to power it, but honestly haven't put too much thought into the design. Can't wait!

Similar to C#, happy to add this as a community-supported plugin once it's closer to shipping.

SockworkOrange commented 3 months ago

Our approach in the C# plugin was the officially maintained libs per db (in MySQL for example), or simply the lightweight, most popular lib. I think that adding an additional ORM abstraction like sequel kind of defeats the purpose, no? The comment on using Dapper for C# here summarizes it well.

For example in Ruby, I thought of using:

@doron050

SockworkOrange commented 3 months ago

Released first version in here, supporting MySQL & Postgres databases, and generating Ruby3 compatible code.

SockworkOrange commented 2 months ago

@kyleconroy can be closed then:)