3 ms·
Same here. I'd love to have a tool that just generates an object type for a given SQL query's result rows, and a function signature for its query parameters.
by jtolmar 6y ago
Same here.
I'd love to have a tool that just generates an object type for a given SQL query's result rows, and a function signature for its query parameters.
- branko_d 6y agoThis! We don't need ORM, we need OQM (object-query mapping)!
- reader_mode 6y agoF# has this + static SQL query string checking at compile time using type providers
- grosskur 6y agosqlc can do this: https://sqlc.dev/ https://sqlc.dev/
- jtolmar 6y agoThis is the nicest one of these from the ones posted, I think it's the model to copy.
- PeterisP 6y ago"just generates an object type for a given SQL query's result rows" For a similar purpose in Python I generally use psycopg with namedtuple resultsets; the namedtuple 'records' do what I need for the returned data and are reasonably efficient.
- aabbcc1241 6y agoJust hack that for Typescript over this weekend (: https://news.ycombinator.com/item?id=26211286 https://news.ycombinator.com/item?id=26211286
- jtolmar 6y agoWow, that was fast! I'm impressed. If you want to keep going forward with it, I'd recommend working on making it clearer what the examples do, and looking at sqlc for Go for inspiration. Of the existing versions of this people replied with, that one had the clearest API, or at least clearest explanation on its landing page.