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

I'm not sure exactly what you mean about parameterization, but I suspect in general my notion of what an ORM is differs from yours (in particular, I don't assume lazy loading). Maybe what I'm thinking isn't appropriately called "ORM" (maybe "type relational mapping" is more appropriate?). At any rate, I don't think type safety should be a challenge (somehow a mapping must be generated for each type, just like SQLAlchemy--in Go this can be either explicit or inferred once via reflection or code generation) and I don't think performance would be more a challenge in Go than any other language (the trick to ORM performance is in building efficient SQL queries, not in reflection or type asserts).



compile-time code generation can only get you so far, unless you're ready to generate every single kind of query beforehand ( which grows exponentially with the number of -to-many relationship). You'll have to rely on introspection but i suspect things won't go smoothly.

anyway, it should make for a good exercise i'm sure.

as for the definition of Object-Relationnal-Mapper the idea is to completely abstract the fact that you're storing your object graph ( or struct graph in the case of go) in a relationnal database. To do so, the developper provides meta data , like an xml file or annotation, to describe the mapping. This is a pretty hard problem.


It's not too difficult. Where I work, we're building a BI tool that maps domain concepts ("objects") to fields in relational databases (we're using Python and building out SQLAlchemy queries, but we're not doing anything that wouldn't easily translate into Go). The domain concepts are analogous to structs in Go or simple classes in Python. You only need to get the mapping data once (in our case, the user configures these mappings in the UI and then we load them at runtime, but these could come from anywhere) and from then on there is no magic.

If you know ahead of time what your types are, then you can do everything in code gen easily.

The tough bit is query optimization.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: