From a4e896ef05f8632d89923153918d6bb12e9ccb21 Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Mon, 30 Mar 2026 21:56:12 +0200 Subject: [PATCH 1/3] fix(cli): use stderr instead of stdout --- lib/sqlxgentools_cli/src/main.rs | 2 +- lib/sqlxgentools_cli/src/parse_models.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sqlxgentools_cli/src/main.rs b/lib/sqlxgentools_cli/src/main.rs index 7de6696..c31979c 100644 --- a/lib/sqlxgentools_cli/src/main.rs +++ b/lib/sqlxgentools_cli/src/main.rs @@ -123,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.", diff --git a/lib/sqlxgentools_cli/src/parse_models.rs b/lib/sqlxgentools_cli/src/parse_models.rs index dbe5648..d004923 100644 --- a/lib/sqlxgentools_cli/src/parse_models.rs +++ b/lib/sqlxgentools_cli/src/parse_models.rs @@ -270,7 +270,7 @@ fn parse_models_from_module_inner(module_path: &Path) -> Result> { let mut models: Vec = vec![]; if module_path.is_file() { - println!("Looking for models to parse from path {:?}.", module_path); + eprintln!("Looking for models to parse from path {:?}.", module_path); models.extend(parse_models(module_path)?); return Ok(models); } From 76cdeb209d75a4f4734396f866032d91f97c985c Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Mon, 30 Mar 2026 21:57:49 +0200 Subject: [PATCH 2/3] docs(cli): add details in comments --- lib/sqlxgentools_cli/src/main.rs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/sqlxgentools_cli/src/main.rs b/lib/sqlxgentools_cli/src/main.rs index c31979c..a5658f9 100644 --- a/lib/sqlxgentools_cli/src/main.rs +++ b/lib/sqlxgentools_cli/src/main.rs @@ -19,8 +19,17 @@ 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, + + /// indicate a column consists of unique values is_unique: Option, + + /// 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, /// to indicate that this field will be used to obtains entities @@ -29,7 +38,7 @@ pub struct SqlGeneratorFieldAttr { } #[derive(FromArgs, PartialEq, Debug)] -/// Generate SQL CREATE TABLE migrations +/// Generate .sql files with CREATE TABLE migrations #[argh(subcommand, name = "gen-migrations")] struct GenerateMigration { /// path of file where to write all in one generated SQL migration @@ -54,13 +63,15 @@ enum GeneratorArgsSubCommands { } #[derive(FromArgs)] -/// SQLX Generator args +/// 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. struct GeneratorArgs { - /// path where to find Cargo.toml + /// path of your main cargo project directory (with the projcet root Cargo.toml file) #[argh(option)] project_root: Option, - /// path of the directory containing models + /// path of the project sub-directory containing models definitions #[argh(option, short = 'm')] models_path: Option, From d4e3f4b88ccfe89a107cafd15929680bbf5158bd Mon Sep 17 00:00:00 2001 From: Matthieu Bessat Date: Mon, 30 Mar 2026 21:57:59 +0200 Subject: [PATCH 3/3] docs: update TODO --- TODO.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/TODO.md b/TODO.md index 5339cc5..47d28ce 100644 --- a/TODO.md +++ b/TODO.md @@ -14,7 +14,9 @@ - insert - update - delete_by_id -- [ ] delete_many +- [x] delete_many by ids + +- [ ] Better CLI documentation - [ ] Config file for project - configure models path @@ -26,5 +28,12 @@ - [ ] Support basic one to many, many to one, belongs to relationships - [ ] Support generating inner join SQL query -- [ ] Better, cleaner migration support +- [ ] Better, cleaner migration support UP and DOWN +- [ ] Add a version side +- [ ] man page +- [ ] Quick start guide +- [ ] Static website + +- [ ] release +- [ ] add comment in the start of the generated repositories files