-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(definitions): Add a implementation of the specification in Rust
- Loading branch information
eexsty
committed
Apr 26, 2022
1 parent
27f3cf2
commit 0118e0f
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
mod specification; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//! # Specification | ||
//! | ||
//! An `serde`-based implementation of the entity generation specification. | ||
//! | ||
use std::collections::HashMap; | ||
|
||
use serde::Deserialize; | ||
|
||
#[derive(Debug, Clone, Deserialize)] | ||
pub struct SpecificationRoot { | ||
pub name: String, | ||
pub location: RustAndKotlinType, | ||
pub feature_flag: String, | ||
pub fields: HashMap<String, SpecificationField> | ||
} | ||
|
||
#[derive(Debug, Clone, Deserialize)] | ||
pub struct RustAndKotlinType { | ||
pub rust: String, | ||
pub kotlin: String | ||
} | ||
|
||
#[derive(Debug, Clone, Deserialize)] | ||
pub struct SpecificationField { | ||
pub kind: RustAndKotlinType, | ||
#[serde(default)] | ||
pub sql: Option<String>, | ||
} |