3 ms·
Congratulation, you just rewrote the base for an orm.
by sametmax 9y ago
Congratulation, you just rewrote the base for an orm.
- kodablah 9y agoSorry, put in my no-ORM edit as you may have been writing this. No, I mean higher level than that. ORMs suck as solving your problems specifically. Think more like an API than an ORM. I just started a side project and here's the beginning of an example of the iface I mean [0] and here's the beginning of an example of the sqlite impl I mean [1] (all untested and really early stage of course, but the idea is there). 0 - https://github.com/cretz/yukup/blob/eecb3b24b33f40e6a1eefaa5a3a6ebcd1d2cb084/yukup/storage/storage.go https://github.com/cretz/yukup/blob/eecb3b24b33f40e6a1eefaa5... 1 - https://github.com/cretz/yukup/tree/eecb3b24b33f40e6a1eefaa5a3a6ebcd1d2cb084/yukup/storage/sqlite https://github.com/cretz/yukup/tree/eecb3b24b33f40e6a1eefaa5...
- sametmax 9y agoBut they abstract the underlying db very well and have an uniform api that you can rely on. It's also tested, documented and battletested. It has drawbacks but if accepting several db is an important goal, you don't want to handcraft this unless you can measure inaceptable perfs.
- kodablah 9y ago> they abstract the underlying db very well I am admittedly unfamiliar with this specific case, but even a cursory glance showed me some sqlite-specific code embedded in the main library portion [0]. 0 - https://github.com/beetbox/beets/blob/4f7c1c9beda6c2a5b0705e868fb61e9b0af0e16d/beets/library.py#L107 https://github.com/beetbox/beets/blob/4f7c1c9beda6c2a5b0705e...
- rekwah 9y agoMore of a DAO than an ORM.
- sametmax 9y agoHence "base". Good orm like sqlalchemy have several layers, each of them building on each others, and you can use each if them independantly depending how much abstraction you want.