News for hackers. Stuff that matters.
Re:Show HN: Rust Web Framework by BlarfMcFlarf on Tuesday October 22, 2024 @06:38PM (#41919421)
You can map objects to db updates, and map query results to objects. Neither of those objects needs to have a mapping to actual relations, like how ORMs insist on.
Re:Show HN: Rust Web Framework by threeseed on Tuesday October 22, 2024 @08:48PM (#41920405)
Only for basic objects.

The minute you add relationships your approach becomes unusable.

There is a reason ORMs have persisted for over 30 years.

Re:Show HN: Rust Web Framework by wtetzner on Tuesday October 22, 2024 @08:56PM (#41920461)
No it doesn't. Why would relationships matter? You handle the relationships in SQL queries, and just copy query results to structs.
Re:Show HN: Rust Web Framework by stickfigure on Tuesday October 22, 2024 @09:16PM (#41920622)
> copy query results to structs

Congratulations, you've invented an ORM.

Re:Show HN: Rust Web Framework by threeseed on Tuesday October 22, 2024 @09:51PM (#41920891)
Majority of ORMs really are nothing more than this.

But then it's nice to have something that generates optimised, database-specific SQL, can handle date/number conversion, supports many-many relationships, converting BLOB to binary streams etc.

Re:Show HN: Rust Web Framework by ursuscamp on Tuesday October 22, 2024 @09:39PM (#41920796)
That’s 1% of an ORM.
Re:Show HN: Rust Web Framework by stickfigure on Wednesday October 23, 2024 @12:45PM (#41926785)
It's at least 30% of most ORMs. And if your homebrew ORM actually gets wide use, it'll grow from there.

Source: Wrote an ORM that other people actually use. Still adding features, twelve years later.

Re:Show HN: Rust Web Framework by wtetzner on Wednesday October 30, 2024 @08:45AM (#41994227)
This is clearly not what anyone means when they say they don't want an ORM.

An ORM library maps an entire relational database to a graph of objects, with the intention of abstracting away the relational database. Copying query results to structs doesn't actually do any of that.

https://en.m.wikipedia.org/wiki/Object%E2%80%93relational_ma...

Re:Show HN: Rust Web Framework by dragonwriter on Tuesday October 22, 2024 @08:52PM (#41920435)
Query results are actual, if transitory, relations.

And db updates are either relations or tuples (and a tuple is a relation with cardinality of 1, so...)

Re:Show HN: Rust Web Framework by wtetzner on Tuesday October 22, 2024 @08:58PM (#41920476)
You can be pedantic if you like, but this is obviously not what anyone means by "ORM".
Re:Show HN: Rust Web Framework by dragonwriter on Tuesday October 22, 2024 @09:00PM (#41920490)
Its literally the exact things that ORMs map between: query results -> objects and object changes -> database updates.
Re:Show HN: Rust Web Framework by wtetzner on Wednesday October 30, 2024 @08:50AM (#41994256)
No, ORMs abstract away the relational database and present it as if it were some kind of object database. Needing to map query results to structs is just incidental, and is completely missing the point of an ORM.

If copying query results to a list of structs is enough to qualify as an ORM, then the term is so generic as to be entirely useless.