DORM - a new D ORM
WebFreak001
d.forum at webfreak.org
Thu Nov 24 06:19:24 UTC 2022
Hello!
at our hackerspace we have been working tirelessly for the past
half year to bring a great new ORM experience to D and Rust. The
D side of this ORM can be found at:
https://code.dlang.org/packages/dorm
It provides a nice D API to directly save data to any database,
restore data, list data, etc.
Current features:
- Declarative table/model definitions from D, with rich UDA
annotations
- Command Line Interface to create migrations automatically from
the D application, good for checking into the source repository
and to distribute with the app
- Migrations allow both users and developers to update the
database in their deployed app instances when needed, coming from
any (or no) previous version
- High-level APIs both in D and Rust
- Support for MySQL, PostgreSQL and sqlite3 (MySQL and PostgreSQL
drivers written in safe Rust)
- Automatic mapping between defined D datatypes and SQL
- Support for slim SQL queries by only using and selecting
columns that are needed
- CRUD interface with support for dereferencing foreign keys,
embedded structs, advanced SQL conditions that can represent
almost any SQL condition using D code that looks similar to
regular if statements
- Support for transactions
- Raw SQL API
- Streaming SQL responses (range interface)
- Async support with vibe.d - also works standalone with and
without multithreading from the application
- Multithreaded connection pool
Documentation can be found here: https://rorm.rs/ (although very
WIP still!)
Minimal sample project:
https://github.com/rorm-orm/dorm/tree/ee221e6c66bf460b77592c208d1620a93a007a66/testapp
Bunch of integration tests, that show all the functionality:
https://github.com/rorm-orm/dorm/tree/ee221e6c66bf460b77592c208d1620a93a007a66/integration-tests
Feel free to try it out and open issues! The API will probably
still change a bunch in the future. However the current modelling
capabilities should already suffice for a wide selection of apps
you might want to test this in.
Looking forward to your feedback.
More information about the Digitalmars-d-announce
mailing list