Compare commits
No commits in common. "d4e3f4b88ccfe89a107cafd15929680bbf5158bd" and "22ab9479b03f37595ef807d001ae59a6685a5e2a" have entirely different histories.
d4e3f4b88c
...
22ab9479b0
3 changed files with 8 additions and 28 deletions
13
TODO.md
13
TODO.md
|
|
@ -14,9 +14,7 @@
|
|||
- insert
|
||||
- update
|
||||
- delete_by_id
|
||||
- [x] delete_many by ids
|
||||
|
||||
- [ ] Better CLI documentation
|
||||
- [ ] delete_many
|
||||
|
||||
- [ ] Config file for project
|
||||
- configure models path
|
||||
|
|
@ -28,12 +26,5 @@
|
|||
|
||||
- [ ] Support basic one to many, many to one, belongs to relationships
|
||||
- [ ] Support generating inner join SQL query
|
||||
- [ ] Better, cleaner migration support UP and DOWN
|
||||
- [ ] Better, cleaner migration support
|
||||
|
||||
- [ ] Add a version side
|
||||
- [ ] man page
|
||||
- [ ] Quick start guide
|
||||
- [ ] Static website
|
||||
|
||||
- [ ] release
|
||||
- [ ] add comment in the start of the generated repositories files
|
||||
|
|
|
|||
|
|
@ -19,17 +19,8 @@ pub struct SqlGeneratorModelAttr {
|
|||
#[derive(FromAttr, PartialEq, Debug, Default)]
|
||||
#[attribute(ident = sql_generator_field)]
|
||||
pub struct SqlGeneratorFieldAttr {
|
||||
/// indicate a primary key
|
||||
/// primary usually means unique + indexed
|
||||
is_primary: Option<bool>,
|
||||
|
||||
/// indicate a column consists of unique values
|
||||
is_unique: Option<bool>,
|
||||
|
||||
/// name of the method to retreive a list of current type items from the point of view of the
|
||||
/// remote foreign table
|
||||
/// generally it's the same name as the current table
|
||||
/// it can change depending on the context
|
||||
reverse_relation_name: Option<String>,
|
||||
|
||||
/// to indicate that this field will be used to obtains entities
|
||||
|
|
@ -38,7 +29,7 @@ pub struct SqlGeneratorFieldAttr {
|
|||
}
|
||||
|
||||
#[derive(FromArgs, PartialEq, Debug)]
|
||||
/// Generate .sql files with CREATE TABLE migrations
|
||||
/// Generate SQL CREATE TABLE migrations
|
||||
#[argh(subcommand, name = "gen-migrations")]
|
||||
struct GenerateMigration {
|
||||
/// path of file where to write all in one generated SQL migration
|
||||
|
|
@ -63,15 +54,13 @@ enum GeneratorArgsSubCommands {
|
|||
}
|
||||
|
||||
#[derive(FromArgs)]
|
||||
/// The Sqlxgentools CLI.
|
||||
/// Sqlxgentools is a set of library and code generators program,
|
||||
/// to help you to use a Sqlite3 database in your Rust app with Sqlx.
|
||||
/// SQLX Generator args
|
||||
struct GeneratorArgs {
|
||||
/// path of your main cargo project directory (with the projcet root Cargo.toml file)
|
||||
/// path where to find Cargo.toml
|
||||
#[argh(option)]
|
||||
project_root: Option<String>,
|
||||
|
||||
/// path of the project sub-directory containing models definitions
|
||||
/// path of the directory containing models
|
||||
#[argh(option, short = 'm')]
|
||||
models_path: Option<String>,
|
||||
|
||||
|
|
@ -134,7 +123,7 @@ pub fn main() -> Result<()> {
|
|||
{
|
||||
models_mod_path.pop();
|
||||
}
|
||||
eprintln!("Found models in project, parsing models…");
|
||||
eprintln!("Found models in project, parsing models");
|
||||
let models = parse_models::parse_models_from_module(&models_mod_path)?;
|
||||
eprintln!(
|
||||
"Found and parsed a grand total of {} sqlxgentools compatible models.",
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ fn parse_models_from_module_inner(module_path: &Path) -> Result<Vec<Model>> {
|
|||
let mut models: Vec<Model> = vec![];
|
||||
|
||||
if module_path.is_file() {
|
||||
eprintln!("Looking for models to parse from path {:?}.", module_path);
|
||||
println!("Looking for models to parse from path {:?}.", module_path);
|
||||
models.extend(parse_models(module_path)?);
|
||||
return Ok(models);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue