SeaORM DBML

Database Markup Language (DBML) transpiler for SeaORM Entity.

crate MSRV MIT or Apache 2.0 licensed unsafe forbidden

Why DBML?

DBML (Database Markup Language) is an open-source DSL language designed to define and document database schemas and structures. It is designed to be simple, consistent and highly-readable.

Read more: Official docs

This project aims to make use of DBML as a language for writing SeaORM entity.

Output

Below is the example of transpiling DBML into SeaORM entity.

dbml Table user { id integer [pk] username varchar role varchar }

```rust //! Generated by sea-orm-dbml 0.1.0

pub mod user { use sea_orm::entity::prelude::*;

#[derive(Clone, Debug, PartialEq, DeriveEntityModel)] #[seaorm(tablename = "user", schemaname = "public")] pub struct Model { #[seaorm(columntype = "Integer", primarykey, autoincrement = false)] pub id: i32, #[seaorm(columntype = "String(None)")] pub username: String, #[seaorm(column_type = "String(None)")] pub role: String, }

#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation {}

impl ActiveModelBehavior for ActiveModel {} }

```

How to use it?

```rust use std::io::Result;

use seaormdbml::*;

fn main() -> Result<()> { config("path/to/your.dbml", transpiler::Target::Postgres) // default: veros("OUTDIR") .setoutpath("out/path/mod.rs") .transpile() }

```

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Always welcome you to participate, contribute and together.