From 3aff64e41b216995860f22dfb6a0918c77e4d9ae Mon Sep 17 00:00:00 2001 From: Einliterflasche Date: Mon, 18 Sep 2023 20:12:20 +0200 Subject: [PATCH] Add documentation for unique modifier, clean up documentation --- pg-worm/README.md | 1 + pg-worm/src/lib.rs | 1 + pg-worm/src/pool.rs | 2 +- pg-worm/src/query/mod.rs | 3 --- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pg-worm/README.md b/pg-worm/README.md index 475bd13..b87cf20 100644 --- a/pg-worm/README.md +++ b/pg-worm/README.md @@ -302,6 +302,7 @@ Option | Meaning | Usage | Default `column_name` | Set this column's name. | `#[column(column_name = "new_column_name")]` | The fields's name converted to snake case using [this crate](https://crates.io/crates/convert_case). `primary_key` | Make this column the primary key. Only use this once per `Model`. If you want this column to be auto generated use `auto` as well. | `#[column(primary_key)]` | `false` `auto` | Make this column auto generated. Works only for `i16`, `i32` and `i64`, as well as `Uuid` *if* the `"uuid"` feature has been enabled *and* you use PostgreSQL version 13 or later. | `#[column(auto)]` | `false` +`unique` | Add the `UNIQUE` constraint to this column | `#[column(unique)]` | `false` ## MSRV diff --git a/pg-worm/src/lib.rs b/pg-worm/src/lib.rs index 1791bc3..abead92 100644 --- a/pg-worm/src/lib.rs +++ b/pg-worm/src/lib.rs @@ -303,6 +303,7 @@ Option | Meaning | Usage | Default `column_name` | Set this column's name. | `#[column(column_name = "new_column_name")]` | The fields's name converted to snake case using [this crate](https://crates.io/crates/convert_case). `primary_key` | Make this column the primary key. Only use this once per `Model`. If you want this column to be auto generated use `auto` as well. | `#[column(primary_key)]` | `false` `auto` | Make this column auto generated. Works only for `i16`, `i32` and `i64`, as well as `Uuid` *if* the `"uuid"` feature has been enabled *and* you use PostgreSQL version 13 or later. | `#[column(auto)]` | `false` +`unique` | Add the `UNIQUE` constraint to this column. | `#[column(unique)]` | `false` ## MSRV diff --git a/pg-worm/src/pool.rs b/pg-worm/src/pool.rs index 4e86665..e744e95 100644 --- a/pg-worm/src/pool.rs +++ b/pg-worm/src/pool.rs @@ -52,7 +52,7 @@ struct Connector { tls: Tls, } -/// A struct for building a [`Pool`] according to your needs. +/// A struct for building a connection pool according to your needs. pub struct ConnectionBuilder { conn_string: String, } diff --git a/pg-worm/src/query/mod.rs b/pg-worm/src/query/mod.rs index bac6ced..0ba4855 100644 --- a/pg-worm/src/query/mod.rs +++ b/pg-worm/src/query/mod.rs @@ -104,9 +104,6 @@ where /// A struct for storing a complete query along with /// parameters and output type. -/// -/// Depending on the output type, [`Executable`] is implemented differently -/// to allow for easy parsing. pub struct Query<'a, T = Vec>(pub String, Vec<&'a (dyn ToSql + Sync)>, PhantomData); /// A basic chunk of SQL and it's params.