weldsorm / welds

BSD 3-Clause "New" or "Revised" License
119 stars 6 forks source link

Switch backend at startup time. #6

Closed marknefedov closed 7 months ago

marknefedov commented 1 year ago

Hi, thank you for your hard work! In the docs I see that DB backend is configured using macro and while I assume it is possible to make switchable backends using cargo feature at compilation time, is there a way to distribute a single binary with all postgres, mysql and sqlite support at the same time, so database can be specified in the config?

lex148 commented 1 year ago

This is unfortunately harder than it should be right now. Moving this up to the top of the list of things to address.

lex148 commented 1 year ago

Hi @marknefedov,

I have been working to cleanup what is required to make a generic binary that can support multiple databases at runtime. There is still work to go, but it is at least possible now.

I have added two examples that you might find useful: https://github.com/weldsorm/welds/blob/main/welds/examples/any_db_runtime.rs https://github.com/weldsorm/welds/blob/main/welds/examples/any_db_compiletime.rs

lex148 commented 7 months ago

HI @marknefedov. its been a while with this ticket. You might want to checkout the latest version of welds. One of the main goals of 0.3 was to address this shortcoming.

Welds can now be 100% switched at runtime.