-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
go sdk support db (mysql/pg) #1750
Comments
I'm interest in it. |
@adamreese Would the pattern you established with the SQLite SDK fit with our BYO relational API? If so, would it be reasonably quick to implement? |
They're a bit different. With SQLite a connection to the database is opened and then closed. MySQL and Postgres don't persist a connection between queries. The API would need to be implemented in a different way. We might be able to fake a "connection" and still use Go's |
Does "our BYO relational API" means wit API in wit directory in project? I see rust sdk using outbound-pg.wit and outbound-mysql.wit which located in wit/ephemeral dir. Can‘t go sdk follow the same way as rust sdk? |
"BYO relational" is an informal term for "bring your own" databases, specifically Postgres and MySQL, as opposed to the "built in" SQLite database - sorry for the confusing term! You are correct that the WIT files define the API. And certainly Go could surface the WIT bindings directly, but they are not very friendly, because they use concepts like discriminated unions that Go doesn't have. In fact, even the Rust SDK provides a bit of a wrapper over the raw WIT to make it more ergonomic. Go is an even trickier case because it has a standard database API and the most ergonomic solution would be to adopt that. @adamreese successfully did that for SQLite but his solution won't work for Postgres or MySQL. If you're happy to work with the WIT bindings directly, you can try running the (I'm still not sure if we will provide official wrappers after #1630, because an idiomatic SDK is non-trivial for the reasons @adamreese describes, and if we shipped a non-idiomatic one we'd be committing to sticking with it for a potentially long period.) I hope that clarifies the problems and opportunities - do let us know if you're interested in working something up from the WIT files! |
Thanks for your reply! I think I get it. Adopting go's standard database API is cool!! May be I can implement it.
This way sounds good. |
Rust sdk already support mysql/pg. But go sdk haven't support db yet.
The text was updated successfully, but these errors were encountered: