Skip to content

Commit 38f6f24

Browse files
committed
docs(README): update for next version release
- fixes errors that were forgotten to change since 0.0.16 - update text to be more readable
1 parent 11b65ef commit 38f6f24

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ diesel::table! {
2424
We run:
2525

2626
```sh
27-
cargo dsync -i schema.rs -o models
27+
dsync -i schema.rs -o models
2828
```
2929

3030
Now we have everything we need!
@@ -45,9 +45,9 @@ async fn demo(db: Connection) {
4545
}
4646
```
4747

48-
For a complete example, see [`test/simple_table/schema.rs`](test/simple_table/schema.rs) which generates all the code in [`test/simple_schema/models`](test/simple_table/models).
48+
For a complete example, see [`test/simple_table_sqlite/schema.rs`](test/simple_table_sqlite/schema.rs) which generates all the code in [`test/simple_schema_sqlite/models`](test/simple_table_sqlite/models).
4949

50-
## Usage
50+
## Usage as a library
5151

5252
1. Add this crate:
5353

@@ -67,7 +67,10 @@ For a complete example, see [`test/simple_table/schema.rs`](test/simple_table/sc
6767
dsync::generate_files(
6868
PathBuf::from_iter([dir, "src/schema.rs"]),
6969
PathBuf::from_iter([dir, "src/models"]),
70-
GenerationConfig { /* ... your generation options ... */ }
70+
GenerationConfig {
71+
connection_type: "diesel::sqlite::SqliteConnection",
72+
options: Default::default(),
73+
}
7174
);
7275
}
7376
```
@@ -104,11 +107,11 @@ cargo install dsync
104107

105108
**CLI Usage**
106109

107-
* `-i`: input argument: path to schema file
108-
* `-o`: output argument: path to directory where generated code should be written
109-
* `-c`: connection type (for example: `diesel::r2d2::PooledConnection<diesel::r2d2::ConnectionManager<diesel::pg::PgConnection>>`)
110+
* `-i`: path to the diesel schema file
111+
* `-o`: model output directory
112+
* `-c`: connection type (for example: `diesel::sqlite::SqliteConnection`)
110113
* `-g`: (optional, repeatable) list of columns that are automatically generated by create/update triggers (for example, `created_at`, `updated_at`)
111-
* `--tsync`: (optional) adds `#[tsync]` attribute to generated structs (see <https://github.com/Wulf/tsync>)
114+
* `--tsync`: (optional) adds `#[tsync]` attribute to generated structs for the [`tsync` crate](https://github.com/Wulf/tsync)
112115
* `--model-path`: (optional) set a custom model import path, default `crate::models::`
113116
* `--schema-path`: (optional) set a custom schema import path, default `crate::schema::`
114117
* `--no-serde`: (optional) if set, does not output any serde related code
@@ -119,15 +122,15 @@ cargo install dsync
119122
* `--readonly-prefix`: (optional, repeatable) A prefix to treat a table matching this as readonly *2
120123
* `--readonly-suffix`: (optional, repeatable) A suffix to treat a table matching this as readonly *2
121124
* `--diesel-backend`: (when the "advanced-queries" feature is enabled) The diesel backend in use (possible values include `diesel::pg::Pg`, `diesel::sqlite::Sqlite`, `diesel::mysql::Mysql`, or your custom backend type)
122-
* note: the CLI has fail-safes to prevent accidental file overwriting
123125

124126
```sh
125127
dsync -i src/schema.rs -o src/models
126128
```
127129

128130
Notes:
129131

130-
- *2: "readonly" tables dont have `Update*` & `Create*` structs, only `*`(no suffix / prefix) structs.
132+
- the CLI has fail-safes to prevent accidental file overwriting
133+
- *2: "readonly" tables dont have `Update*`(`UpdateTodos`) & `Create*`(`CreateTodos`) structs, only `*`(`Todos`, no suffix / prefix) structs.
131134
For example this is useful for Sqlite views, which are read-only (cannot be written to, but can be read)
132135

133136
## Experimental API
@@ -140,7 +143,9 @@ Feel free to open an issue to discuss these API and provide your feeedback.
140143
141144
## Docs
142145
143-
See `dsync --help` for more information.
146+
See `dsync --help` for all CLI arguments and documentation.
147+
148+
See [docs.rs](https://docs.rs/dsync/latest/dsync/) for library documentation.
144149
145150
Feel free to open tickets for support or feature requests.
146151

0 commit comments

Comments
 (0)