Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There is only one option: diesel [1]. It is a powerful solution for correctness, as it is completely type-safe. It's also really fast since a lot of work is delegated to compile time.

There are also plenty of drawbacks though: the extensive type system hacking can lead to very confusing compiler errors, it doesn't work well when you need to sometimes fall back to more dynamic db handling, and it doesn't handle large tables well. (very long compile times etc), and the documentation is quite sparse.

It's a robust solution for greenfield projects where you can design the schema partially with diesel in mind, but I wouldn't recommend it for existing DBs or projects that you know will grow large (eg 100+ column tables etc).

[1] https://github.com/diesel-rs/diesel



it doesn't handle large tables well. (very long compile times etc)

By large tables you mean a large number of columns, not a large number of rows, right?


Correct.

Fun fact: The amount of traits implementations that need to be generated to support tables with 128 columns actually makes diesel an interest benchmark of the Rust compiler.


Would the recent work on const generics help with this?


Not sure. Having the ability to abstract over tuples (using a similar mechanism as HLists for example) would help.


Correct.




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

Search: