protobuf-dbml

Crates.ioprotobuf-dbml
lib.rsprotobuf-dbml
version0.1.0-beta.3
sourcesrc
created_at2023-07-15 17:34:08.531025
updated_at2023-07-15 17:41:19.341298
descriptionDBML transpiler for Protocol Buffers.
homepage
repositoryhttps://github.com/apskhem/protobuf-dbml
max_upload_size
id917326
size36,262
Apisit Ritreungroj (apskhem)

documentation

README

Protobuf DBML

Database Markup Language (DBML) transpiler for Protocol Buffers.

MSRV MIT or Apache 2.0 licensed unsafe forbidden

Output

Below is the example of transpiling DBML into protobuf.

Table user {
  id integer [pk]
  username varchar
  role varchar
}
//! Generated by protobuf-dbml 0.1.0-beta.2

syntax = "proto3";

message UserSchema {
  int32 id = 1;
  string username = 2;
  string role = 3;
}

How to use it?

use std::{error::Error, ffi::OsString};

use protobuf_dbml::*;

fn main() -> Result<(), Box<dyn Error>> {
  transpile(transpiler::config::Config {
    in_path: OsString::from("path/to/your/dbml.dbml"),
    out_path: OsString::from("path/to/your/out.proto"),
    ..Default::default()
  })
}

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.

Commit count: 8

cargo fmt