RocketBoost Orbit logo Orbit rocketboost.rs

Introduction

Orbit is an ORM for Rocket.rs apps. It maps MySQL and MariaDB tables to Rust types, and runs queries, transactions and migrations against them. Its names follow Laravel's Eloquent and query builder, so most of it will be familiar to a Laravel developer. Differences from Laravel lists where Orbit departs from Laravel.

What Orbit covers

  • Connecting opens a connection pool and checks that the database answers.
  • Models map a table to a struct. The OrbitModel derive writes the mapping.
  • Queries build SELECT, INSERT, UPDATE, DELETE and REPLACE statements. Values are always sent as bound parameters.
  • Transactions commit when a closure returns Ok and roll back when it returns Err or panics.
  • Errors lists the typed errors, such as unique and foreign key violations, deadlocks and lock wait timeouts.
  • Migrations apply and revert folders of SQL, and can import the history of a Diesel project.
  • Blocking API is a synchronous version of the same queries, behind the blocking feature.

Databases

Orbit works with MySQL and MariaDB. It does not support other databases yet.

Where to start

Add the crate with the steps in Installation, then connect as shown in Connecting.