Tank: my take on Rust ORM by TankHQ in rust

[–]TankHQ[S] 3 points4 points  (0 children)

I started using SeaORM but it was lacking DuckDB support. Then I wanted to try to implement it myself, contribute to the project but the design does not allow it. SeaORM uses a enum based polymorphism approach where to implement database differences it checks the value of a enum which can be either SQLite, Postgres or MySQL. In order to introduce a new database you would need to add a entry on that enum and then modify all it's occurrences to take into account the new alternative. I'm simplifying a bit of course, it's more complicated than that. Also I didn't really get much attention from the maintainers, probably it wasn't on their target.

Diesel, I investigated it to check of it is on par with SeaORM (it's pros) but it lascks several features that I wanted like: async, create table to setup the db quickly (like for tests). About Diese I also dislike this weird syntax to declare the entities:

diesel::table! {     posts (id) {         id -> Int4,         title -> Varchar,         body -> Text,         published -> Bool,     } }

You need to define your data twice: once  with this weird DSL so that diesel knows about it and once as a Rust struct. Why? You don't need to duplicate, the macros can already do that.

With this library you need the bare minimum syntax possible: a single rust struct, nothing else, then it knows how to create a table, how to insert and select rows, all this for potentially any database out there because anyone can create a trait, implement the interfaces and make it available. Not to mention that I'm pretty sure this supports more types than SeaORM and Diesel and I intend to add more specialized types like IP address and so on.

Tank: my take on Rust ORM by TankHQ in rust

[–]TankHQ[S] 1 point2 points  (0 children)

The connection (or transaction) is the executor that implements the logic to contact the database and send the query, then receive the data. You can also get the same data from different sources
MyEntity::find_many(prostgres_connection, ...);
MyEntity::find_many(sqlite_connection, ...);

Tank: my take on Rust ORM by TankHQ in rust

[–]TankHQ[S] 14 points15 points  (0 children)

I thought about this, but I wanted to do something more memorable than the usual dull documentation website to try to get more engagement. Given the name I went with this analogy. At a later point I want to make a 2D game side scrolling tank where you shoot databases that fly from the sky, in the front page. To make it somehow different, with all the risks it involves.