4 releases

0.0.4 Nov 25, 2020
0.0.3 Nov 23, 2020
0.0.2 Nov 23, 2020
0.0.1 Nov 10, 2020

#2436 in Database interfaces

MIT/Apache

17KB
169 lines

latitude

Latitude is a library for dynamic runtime DDL based on sqlx and barrel. NOTE: This project is in early development along with sqlx. Please use at your own risk and strongly consider using a better tested and polished project such as Refinery. There will definitely be API changes in the near future.

Originally this was intended to to be a migration toolkit, but, it has been slimmed down. It's unclear if we will still pursue a migration oriented API. Adding migration capability would be a feature addition as opposed to a rewrite.

With the migration changes this library could be considered amore portable but less accessible alternative to sqlx-cli: users require less concern over understanding and maintaining multiple SQL dialects, but, must have familiarity with Rust to get up and running. It may be a good fit if your application is already written in Rust and either:

  • you want migration compatibility across multiple databases (e.g. if you are using MySQL in production and SQLite for development); or

  • you just like writing in the DSL over plain SQL

Please raise an issue on GitHub if you have suggestions, feedback, bug reports, or otherwise.

Getting Started

latitude = 0.0.1

Usage

use latitude::prelude::*;

let connection = Connection::new("sqlite::memory:").await?;

db::create().execute(&connection).await?;

let date_updated = date().nullable(true);

table::create("users")
      .column("name", varchar(255))
      .column("age",  integer())
      .column("date_updated", date_updated)
      .execute(&mut connection)
      .await?

db::drop().execute(&connection).await?;

License: MIT OR Apache-2.0

Dependencies

~60MB
~1M SLoC