KO
|
EN
gitlite โ search
Search
#python
#java
#python3
#arduino
#golang
#machine-learning
#rust
#html
#flask
#javascript
#seismology
#nodejs
awto
โ 24
Open GitHub โ
Awtomate your ๐ฆ microservices with awto
Download README (.md)
Explore Similar Repositories
plugin-git
:
Woodpecker plugin for cloning Git repositories
deploy-ml-model-as-android-app
:
Code to deploy ML model as an Android App
FairMOT-attack
:
No description available.
archlinux-ansible-provisioner
:
Yet another Archlinux ansible provisioner
dl_common_script
:
ๆทฑๅบฆๅญฆไน ๅธธ็จ็่ๆฌ๏ผๆฏๅฆๅ ฌๅ ฑๆฐๆฎ้๏ผTusimple,VOC็ญ๏ผ็่ฝฌๆข(xml2json,json2xml,yolo2voc)๏ผ่ฏปๅ่ง้ข๏ผๅ็ฆป่ฎญ็ป้ช่ฏ้็ญ
// repository documentation
Was this content helpful?
โ 0
(0 ratings)
Select Rating:
โ
โ
โ
โ
โ
Submit Feedback
Recent Feedback
×
Download README
Do you want to download the
README.md
file for
awto
?
Download (.md)
<div align="center"> <h1>awto</h1> <p> <strong>Awtomate your ๐ฆ microservices with awto</strong> </p> [](https://crates.io/crates/awto) </div> ## What is awto? Awto treats your rust project as the source of truth for microservices, and generates **database tables** and **protobufs** based on your schema and service. #### Database Generation - Database tables are generated from your Rust structs - Changes to your structs are detected and will modify the table schema accordingly #### Protobuf Generation - Generate protobuf schemas from your models - Compile a protobuf server from your app's service ## Concepts With awto, you create a [Cargo workspace](https://doc.rust-lang.org/cargo/reference/workspaces.html) for each microservice. Under your workspace, you create two libs: **`schema`** and **`service`** #### Schema The schema lib's purpose is to define your microservice models which will be used to generate database tables. ```rust // schema/src/lib.rs use awto::prelude::*; schema! { #[database_table] #[protobuf_message] pub struct Product { pub id: Uuid, pub created_at: DateTime<FixedOffset>, pub updated_at: DateTime<FixedOffset>, pub name: String, #[awto(max_len = 120)] pub description: Option<String>, #[awto(default = 0)] pub price: i64, } } ``` _See example schema in [`examples/ecom`](examples/ecom/schema/src/lib.rs)._ #### Service The service lib is where you write your business logic. This business logic can later be used to create a protobuf API _(and in the future a graphql API)_. ```rust // service/src/lib.rs register_services!(ProductService); pub struct ProductService { pub conn: DatabaseConnection, } #[protobuf_service] impl ProductService { pub async fn find_by_id(&self, request: ProductId) -> Result<Product, Status> { let product = product::Entity::find_by_id(request.id) .one(&self.conn) .await .map_err(|err| Status::internal(err.to_string()))? .ok_or_else(|| Status::not_found("product not found"))?; Ok(product.into()) } } ``` _See example service in [`examples/ecom`](examples/ecom/service/src/product.rs)._ #### Cargo workspace Your schema and service libs should be under a cargo workspace. ```toml # root Cargo.toml [workspace] members = ["schema", "service"] ``` _See example project in [`examples/ecom`](examples/ecom)._ ## Awto CLI Awto provides a cli for generating additional libraries with the `awto compile <lib>` command. Currently the available libraries are: - **`database`** - based on [SeaORM](https://github.com/SeaQL/sea-orm), provides a database library for use in your service - **`protobuf`** - based on [tonic](https://github.com/hyperium/tonic), provides a protobuf server library #### Install The cli can be installed with: ```bash cargo install awto-cli ``` This will provide a binary called `awto`. Check installation with `awto --help`. #### Compile library To compile a library, you can run: ```bash awto compile <output> ``` The available outputs currently are: - `database` - syncs your database with your schema and generates a lib for performing operations with the database via [SeaORM](https://github.com/SeaQL/sea-orm). - `protobuf` - generates a protobuf file and lib which can be used as a protobuf server & client via [tonic](https://github.com/hyperium/tonic). ## Roadmap Awto is still in alpha stages and is made mostly as an experiment at this point. If it gets some attention, serious effort will be put into it to make it a meaningful tool for the Rust community. ## Contributing Whether you want to share ideas, bugs, suggestions, or other, your contributions to this project are welcomed ๐ค ## License By contributing, you agree that your contributions will be licensed under this repository's [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE) License.