From 8c00d73925666bea15e8ed945be3a8c6b9a27943 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Mon, 11 Dec 2023 17:37:16 +0100 Subject: [PATCH 1/3] feat(code): change all diesel derives to use "diesel::" prefix --- src/code.rs | 14 +++++++------- test/autogenerated_all/models/todos/generated.rs | 4 ++-- .../models/todos/generated.rs | 6 +++--- .../models/todos/generated.rs | 6 +++--- .../models/todos/generated.rs | 6 +++--- .../models/todos/generated.rs | 6 +++--- .../models/todos/generated.rs | 6 +++--- .../models/todos/generated.rs | 6 +++--- .../models/todos/generated.rs | 6 +++--- .../models/table_a/generated.rs | 4 ++-- .../models/table_b/generated.rs | 6 +++--- test/custom_model_path/models/table_a/generated.rs | 4 ++-- test/custom_model_path/models/table_b/generated.rs | 6 +++--- test/manual_primary_keys/models/todos/generated.rs | 4 ++-- .../models/users/generated.rs | 6 +++--- test/no_default_features/models/todos/generated.rs | 6 +++--- .../once_common_structs/models/table1/generated.rs | 2 +- .../once_common_structs/models/table2/generated.rs | 2 +- .../models/table1/generated.rs | 2 +- .../models/table2/generated.rs | 2 +- .../models/table1.rs | 2 +- .../models/table2.rs | 2 +- .../models/table1/generated.rs | 2 +- .../models/table2/generated.rs | 2 +- test/readonly/models/normal/generated.rs | 6 +++--- test/readonly/models/prefix_table/generated.rs | 2 +- .../models/prefix_table_suffix/generated.rs | 2 +- test/readonly/models/table_suffix/generated.rs | 2 +- test/simple_table/models/todos/generated.rs | 6 +++--- test/simple_table_async/models/todos/generated.rs | 6 +++--- .../models/todos/generated.rs | 6 +++--- .../simple_table_no_crud/models/todos/generated.rs | 6 +++--- .../models/todos/generated.rs | 6 +++--- test/single_model_file/models/table1.rs | 2 +- test/single_model_file/models/table2.rs | 2 +- test/use_statements/models/fang_tasks/generated.rs | 6 +++--- 36 files changed, 82 insertions(+), 82 deletions(-) diff --git a/src/code.rs b/src/code.rs index de6e224e..27458c66 100644 --- a/src/code.rs +++ b/src/code.rs @@ -117,16 +117,16 @@ pub mod derives { pub const DEBUG: &str = "Debug"; pub const DEFAULT: &str = "Default"; pub const CLONE: &str = "Clone"; - pub const QUERYABLE: &str = "Queryable"; - pub const INSERTABLE: &str = "Insertable"; + pub const QUERYABLE: &str = "diesel::Queryable"; + pub const INSERTABLE: &str = "diesel::Insertable"; pub const SERIALIZE: &str = "serde::Serialize"; pub const DESERIALIZE: &str = "serde::Deserialize"; - pub const ASCHANGESET: &str = "AsChangeset"; - pub const SELECTABLE: &str = "Selectable"; - pub const IDENTIFIABLE: &str = "Identifiable"; - pub const ASSOCIATIONS: &str = "Associations"; + pub const ASCHANGESET: &str = "diesel::AsChangeset"; + pub const SELECTABLE: &str = "diesel::Selectable"; + pub const IDENTIFIABLE: &str = "diesel::Identifiable"; + pub const ASSOCIATIONS: &str = "diesel::Associations"; #[cfg(feature = "derive-queryablebyname")] - pub const QUERYABLEBYNAME: &str = "QueryableByName"; + pub const QUERYABLEBYNAME: &str = "diesel::QueryableByName"; pub const PARTIALEQ: &str = "PartialEq"; } diff --git a/test/autogenerated_all/models/todos/generated.rs b/test/autogenerated_all/models/todos/generated.rs index 6655ecc1..d0df5ab0 100644 --- a/test/autogenerated_all/models/todos/generated.rs +++ b/test/autogenerated_all/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -17,7 +17,7 @@ pub struct Todos { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { /// Field representing column `created_at` diff --git a/test/autogenerated_attributes/models/todos/generated.rs b/test/autogenerated_attributes/models/todos/generated.rs index 51346d09..6c6bf519 100644 --- a/test/autogenerated_attributes/models/todos/generated.rs +++ b/test/autogenerated_attributes/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -17,7 +17,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { /// Field representing column `id` @@ -25,7 +25,7 @@ pub struct CreateTodos { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { /// Field representing column `created_at` diff --git a/test/autogenerated_primary_keys/models/todos/generated.rs b/test/autogenerated_primary_keys/models/todos/generated.rs index fa92bf9b..032cb47a 100644 --- a/test/autogenerated_primary_keys/models/todos/generated.rs +++ b/test/autogenerated_primary_keys/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -17,7 +17,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { /// Field representing column `text` @@ -25,7 +25,7 @@ pub struct CreateTodos { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { /// Field representing column `text` diff --git a/test/cleanup_generated_content/models/todos/generated.rs b/test/cleanup_generated_content/models/todos/generated.rs index 44fae0e0..98895979 100644 --- a/test/cleanup_generated_content/models/todos/generated.rs +++ b/test/cleanup_generated_content/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -23,7 +23,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { /// Field representing column `id` @@ -35,7 +35,7 @@ pub struct CreateTodos { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { /// Field representing column `text` diff --git a/test/create_update_bytes_cow/models/todos/generated.rs b/test/create_update_bytes_cow/models/todos/generated.rs index 3b07f00a..a62131e5 100644 --- a/test/create_update_bytes_cow/models/todos/generated.rs +++ b/test/create_update_bytes_cow/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(data))] pub struct Todos { /// Field representing column `data` @@ -17,7 +17,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos<'a> { /// Field representing column `data` @@ -27,7 +27,7 @@ pub struct CreateTodos<'a> { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos<'a> { /// Field representing column `data_nullable` diff --git a/test/create_update_bytes_slice/models/todos/generated.rs b/test/create_update_bytes_slice/models/todos/generated.rs index a567b876..57f4d475 100644 --- a/test/create_update_bytes_slice/models/todos/generated.rs +++ b/test/create_update_bytes_slice/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(data))] pub struct Todos { /// Field representing column `data` @@ -17,7 +17,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos<'a> { /// Field representing column `data` @@ -27,7 +27,7 @@ pub struct CreateTodos<'a> { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos<'a> { /// Field representing column `data_nullable` diff --git a/test/create_update_str_cow/models/todos/generated.rs b/test/create_update_str_cow/models/todos/generated.rs index 75562fcb..82267e41 100644 --- a/test/create_update_str_cow/models/todos/generated.rs +++ b/test/create_update_str_cow/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(text))] pub struct Todos { /// Field representing column `text` @@ -21,7 +21,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos<'a> { /// Field representing column `text` @@ -35,7 +35,7 @@ pub struct CreateTodos<'a> { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos<'a> { /// Field representing column `text_nullable` diff --git a/test/create_update_str_str/models/todos/generated.rs b/test/create_update_str_str/models/todos/generated.rs index d7d06248..1f58b7b5 100644 --- a/test/create_update_str_str/models/todos/generated.rs +++ b/test/create_update_str_str/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(text))] pub struct Todos { /// Field representing column `text` @@ -21,7 +21,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos<'a> { /// Field representing column `text` @@ -35,7 +35,7 @@ pub struct CreateTodos<'a> { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos<'a> { /// Field representing column `text_nullable` diff --git a/test/custom_model_and_schema_path/models/table_a/generated.rs b/test/custom_model_and_schema_path/models/table_a/generated.rs index d4b7a998..ee259fda 100644 --- a/test/custom_model_and_schema_path/models/table_a/generated.rs +++ b/test/custom_model_and_schema_path/models/table_a/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `tableA` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=tableA, primary_key(_id))] pub struct TableA { /// Field representing column `_id` @@ -15,7 +15,7 @@ pub struct TableA { } /// Create Struct for a row in table `tableA` for [`TableA`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=tableA)] pub struct CreateTableA { /// Field representing column `_id` diff --git a/test/custom_model_and_schema_path/models/table_b/generated.rs b/test/custom_model_and_schema_path/models/table_b/generated.rs index 0629c5b8..d0f4b94b 100644 --- a/test/custom_model_and_schema_path/models/table_b/generated.rs +++ b/test/custom_model_and_schema_path/models/table_b/generated.rs @@ -8,7 +8,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `tableB` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName, Associations, Identifiable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName, diesel::Associations, diesel::Identifiable)] #[diesel(table_name=tableB, primary_key(_id), belongs_to(TableA, foreign_key=link))] pub struct TableB { /// Field representing column `_id` @@ -18,7 +18,7 @@ pub struct TableB { } /// Create Struct for a row in table `tableB` for [`TableB`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=tableB)] pub struct CreateTableB { /// Field representing column `_id` @@ -28,7 +28,7 @@ pub struct CreateTableB { } /// Update Struct for a row in table `tableB` for [`TableB`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=tableB)] pub struct UpdateTableB { /// Field representing column `link` diff --git a/test/custom_model_path/models/table_a/generated.rs b/test/custom_model_path/models/table_a/generated.rs index e0dce556..38fe8a59 100644 --- a/test/custom_model_path/models/table_a/generated.rs +++ b/test/custom_model_path/models/table_a/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `tableA` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=tableA, primary_key(_id))] pub struct TableA { /// Field representing column `_id` @@ -15,7 +15,7 @@ pub struct TableA { } /// Create Struct for a row in table `tableA` for [`TableA`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=tableA)] pub struct CreateTableA { /// Field representing column `_id` diff --git a/test/custom_model_path/models/table_b/generated.rs b/test/custom_model_path/models/table_b/generated.rs index fcc0e7a5..55fbd549 100644 --- a/test/custom_model_path/models/table_b/generated.rs +++ b/test/custom_model_path/models/table_b/generated.rs @@ -8,7 +8,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `tableB` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName, Associations, Identifiable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName, diesel::Associations, diesel::Identifiable)] #[diesel(table_name=tableB, primary_key(_id), belongs_to(TableA, foreign_key=link))] pub struct TableB { /// Field representing column `_id` @@ -18,7 +18,7 @@ pub struct TableB { } /// Create Struct for a row in table `tableB` for [`TableB`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=tableB)] pub struct CreateTableB { /// Field representing column `_id` @@ -28,7 +28,7 @@ pub struct CreateTableB { } /// Update Struct for a row in table `tableB` for [`TableB`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=tableB)] pub struct UpdateTableB { /// Field representing column `link` diff --git a/test/manual_primary_keys/models/todos/generated.rs b/test/manual_primary_keys/models/todos/generated.rs index a74fb2a7..8e7bedc3 100644 --- a/test/manual_primary_keys/models/todos/generated.rs +++ b/test/manual_primary_keys/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -15,7 +15,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { /// Field representing column `id` diff --git a/test/multiple_primary_keys/models/users/generated.rs b/test/multiple_primary_keys/models/users/generated.rs index 5b8d0151..bd990300 100644 --- a/test/multiple_primary_keys/models/users/generated.rs +++ b/test/multiple_primary_keys/models/users/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `users` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=users, primary_key(name,address))] pub struct Users { /// Field representing column `name` @@ -19,7 +19,7 @@ pub struct Users { } /// Create Struct for a row in table `users` for [`Users`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=users)] pub struct CreateUsers { /// Field representing column `name` @@ -31,7 +31,7 @@ pub struct CreateUsers { } /// Update Struct for a row in table `users` for [`Users`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=users)] pub struct UpdateUsers { /// Field representing column `secret` diff --git a/test/no_default_features/models/todos/generated.rs b/test/no_default_features/models/todos/generated.rs index 7919da1e..d4be42bd 100644 --- a/test/no_default_features/models/todos/generated.rs +++ b/test/no_default_features/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -29,7 +29,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { /// Field representing column `unsigned` @@ -45,7 +45,7 @@ pub struct CreateTodos { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { /// Field representing column `unsigned` diff --git a/test/once_common_structs/models/table1/generated.rs b/test/once_common_structs/models/table1/generated.rs index 5087f0db..ada81b32 100644 --- a/test/once_common_structs/models/table1/generated.rs +++ b/test/once_common_structs/models/table1/generated.rs @@ -8,7 +8,7 @@ use crate::models::common::*; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `table1` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=table1, primary_key(id))] pub struct Table1 { /// Field representing column `id` diff --git a/test/once_common_structs/models/table2/generated.rs b/test/once_common_structs/models/table2/generated.rs index 4a1744df..3fb531c2 100644 --- a/test/once_common_structs/models/table2/generated.rs +++ b/test/once_common_structs/models/table2/generated.rs @@ -8,7 +8,7 @@ use crate::models::common::*; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `table2` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=table2, primary_key(id))] pub struct Table2 { /// Field representing column `id` diff --git a/test/once_common_structs_once_connection_type/models/table1/generated.rs b/test/once_common_structs_once_connection_type/models/table1/generated.rs index b83060fc..db18bfaa 100644 --- a/test/once_common_structs_once_connection_type/models/table1/generated.rs +++ b/test/once_common_structs_once_connection_type/models/table1/generated.rs @@ -6,7 +6,7 @@ use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table1` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=table1, primary_key(id))] pub struct Table1 { /// Field representing column `id` diff --git a/test/once_common_structs_once_connection_type/models/table2/generated.rs b/test/once_common_structs_once_connection_type/models/table2/generated.rs index 8b8a87f4..fba33e63 100644 --- a/test/once_common_structs_once_connection_type/models/table2/generated.rs +++ b/test/once_common_structs_once_connection_type/models/table2/generated.rs @@ -6,7 +6,7 @@ use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table2` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=table2, primary_key(id))] pub struct Table2 { /// Field representing column `id` diff --git a/test/once_common_structs_once_connection_type_single_file/models/table1.rs b/test/once_common_structs_once_connection_type_single_file/models/table1.rs index b83060fc..db18bfaa 100644 --- a/test/once_common_structs_once_connection_type_single_file/models/table1.rs +++ b/test/once_common_structs_once_connection_type_single_file/models/table1.rs @@ -6,7 +6,7 @@ use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table1` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=table1, primary_key(id))] pub struct Table1 { /// Field representing column `id` diff --git a/test/once_common_structs_once_connection_type_single_file/models/table2.rs b/test/once_common_structs_once_connection_type_single_file/models/table2.rs index 8b8a87f4..fba33e63 100644 --- a/test/once_common_structs_once_connection_type_single_file/models/table2.rs +++ b/test/once_common_structs_once_connection_type_single_file/models/table2.rs @@ -6,7 +6,7 @@ use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table2` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=table2, primary_key(id))] pub struct Table2 { /// Field representing column `id` diff --git a/test/once_connection_type/models/table1/generated.rs b/test/once_connection_type/models/table1/generated.rs index 874960f9..ebf5d096 100644 --- a/test/once_connection_type/models/table1/generated.rs +++ b/test/once_connection_type/models/table1/generated.rs @@ -6,7 +6,7 @@ use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table1` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=table1, primary_key(id))] pub struct Table1 { /// Field representing column `id` diff --git a/test/once_connection_type/models/table2/generated.rs b/test/once_connection_type/models/table2/generated.rs index 72359327..de1f66d5 100644 --- a/test/once_connection_type/models/table2/generated.rs +++ b/test/once_connection_type/models/table2/generated.rs @@ -6,7 +6,7 @@ use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table2` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=table2, primary_key(id))] pub struct Table2 { /// Field representing column `id` diff --git a/test/readonly/models/normal/generated.rs b/test/readonly/models/normal/generated.rs index c4011c66..134ed36c 100644 --- a/test/readonly/models/normal/generated.rs +++ b/test/readonly/models/normal/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `normal` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=normal, primary_key(id))] pub struct Normal { /// Field representing column `id` @@ -17,7 +17,7 @@ pub struct Normal { } /// Create Struct for a row in table `normal` for [`Normal`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=normal)] pub struct CreateNormal { /// Field representing column `testprop` @@ -25,7 +25,7 @@ pub struct CreateNormal { } /// Update Struct for a row in table `normal` for [`Normal`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=normal)] pub struct UpdateNormal { /// Field representing column `testprop` diff --git a/test/readonly/models/prefix_table/generated.rs b/test/readonly/models/prefix_table/generated.rs index 61fc2836..0e854452 100644 --- a/test/readonly/models/prefix_table/generated.rs +++ b/test/readonly/models/prefix_table/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `prefixTable` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=prefixTable, primary_key(id))] pub struct PrefixTable { /// Field representing column `id` diff --git a/test/readonly/models/prefix_table_suffix/generated.rs b/test/readonly/models/prefix_table_suffix/generated.rs index c2827b97..def11620 100644 --- a/test/readonly/models/prefix_table_suffix/generated.rs +++ b/test/readonly/models/prefix_table_suffix/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `prefixTableSuffix` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=prefixTableSuffix, primary_key(id))] pub struct PrefixTableSuffix { /// Field representing column `id` diff --git a/test/readonly/models/table_suffix/generated.rs b/test/readonly/models/table_suffix/generated.rs index 140649dc..c2dbc0f6 100644 --- a/test/readonly/models/table_suffix/generated.rs +++ b/test/readonly/models/table_suffix/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `tableSuffix` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=tableSuffix, primary_key(id))] pub struct TableSuffix { /// Field representing column `id` diff --git a/test/simple_table/models/todos/generated.rs b/test/simple_table/models/todos/generated.rs index 385a9d02..5af259ec 100644 --- a/test/simple_table/models/todos/generated.rs +++ b/test/simple_table/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -29,7 +29,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { /// Field representing column `unsigned` @@ -45,7 +45,7 @@ pub struct CreateTodos { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { /// Field representing column `unsigned` diff --git a/test/simple_table_async/models/todos/generated.rs b/test/simple_table_async/models/todos/generated.rs index f9a59684..1977be43 100644 --- a/test/simple_table_async/models/todos/generated.rs +++ b/test/simple_table_async/models/todos/generated.rs @@ -8,7 +8,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel_async::pooled_connection::deadpool::Object; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -26,7 +26,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { /// Field representing column `unsigned` @@ -38,7 +38,7 @@ pub struct CreateTodos { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { /// Field representing column `unsigned` diff --git a/test/simple_table_custom_schema_path/models/todos/generated.rs b/test/simple_table_custom_schema_path/models/todos/generated.rs index 367de56f..b9109d82 100644 --- a/test/simple_table_custom_schema_path/models/todos/generated.rs +++ b/test/simple_table_custom_schema_path/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -25,7 +25,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { /// Field representing column `unsigned` @@ -37,7 +37,7 @@ pub struct CreateTodos { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { /// Field representing column `unsigned` diff --git a/test/simple_table_no_crud/models/todos/generated.rs b/test/simple_table_no_crud/models/todos/generated.rs index 9694f4dd..9825137e 100644 --- a/test/simple_table_no_crud/models/todos/generated.rs +++ b/test/simple_table_no_crud/models/todos/generated.rs @@ -4,7 +4,7 @@ use crate::diesel::*; use crate::schema::*; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -22,7 +22,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { /// Field representing column `unsigned` @@ -34,7 +34,7 @@ pub struct CreateTodos { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { /// Field representing column `unsigned` diff --git a/test/simple_table_no_serde/models/todos/generated.rs b/test/simple_table_no_serde/models/todos/generated.rs index 39bc5169..f6fd77b7 100644 --- a/test/simple_table_no_serde/models/todos/generated.rs +++ b/test/simple_table_no_serde/models/todos/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `todos` -#[derive(Debug, Clone, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=todos, primary_key(id))] pub struct Todos { /// Field representing column `id` @@ -25,7 +25,7 @@ pub struct Todos { } /// Create Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, Insertable)] +#[derive(Debug, Clone, diesel::Insertable)] #[diesel(table_name=todos)] pub struct CreateTodos { /// Field representing column `unsigned` @@ -37,7 +37,7 @@ pub struct CreateTodos { } /// Update Struct for a row in table `todos` for [`Todos`] -#[derive(Debug, Clone, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=todos)] pub struct UpdateTodos { /// Field representing column `unsigned` diff --git a/test/single_model_file/models/table1.rs b/test/single_model_file/models/table1.rs index ccb7f2ce..23b75ef1 100644 --- a/test/single_model_file/models/table1.rs +++ b/test/single_model_file/models/table1.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `table1` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=table1, primary_key(id))] pub struct Table1 { /// Field representing column `id` diff --git a/test/single_model_file/models/table2.rs b/test/single_model_file/models/table2.rs index 7ab3467a..863aa4fc 100644 --- a/test/single_model_file/models/table2.rs +++ b/test/single_model_file/models/table2.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `table2` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=table2, primary_key(id))] pub struct Table2 { /// Field representing column `id` diff --git a/test/use_statements/models/fang_tasks/generated.rs b/test/use_statements/models/fang_tasks/generated.rs index d38f3050..b2e2dc9f 100644 --- a/test/use_statements/models/fang_tasks/generated.rs +++ b/test/use_statements/models/fang_tasks/generated.rs @@ -7,7 +7,7 @@ use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; /// Struct representing a row in table `fang_tasks` -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Queryable, Selectable, QueryableByName)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Queryable, diesel::Selectable, diesel::QueryableByName)] #[diesel(table_name=fang_tasks, primary_key(id))] pub struct FangTasks { /// Field representing column `id` @@ -33,7 +33,7 @@ pub struct FangTasks { } /// Create Struct for a row in table `fang_tasks` for [`FangTasks`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, Insertable)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::Insertable)] #[diesel(table_name=fang_tasks)] pub struct CreateFangTasks { /// Field representing column `id` @@ -59,7 +59,7 @@ pub struct CreateFangTasks { } /// Update Struct for a row in table `fang_tasks` for [`FangTasks`] -#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, AsChangeset, PartialEq, Default)] +#[derive(Debug, Clone, serde::Serialize, serde::Deserialize, diesel::AsChangeset, PartialEq, Default)] #[diesel(table_name=fang_tasks)] pub struct UpdateFangTasks { /// Field representing column `metadata` From 0008e4d91eeb7fcbf829f341f820797426435eb1 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Mon, 11 Dec 2023 17:38:10 +0100 Subject: [PATCH 2/3] feat(code): change table functions "insert_into" to also use "diesel::" prefix (like other functions) --- src/code.rs | 4 ++-- test/autogenerated_all/models/todos/generated.rs | 2 +- test/autogenerated_attributes/models/todos/generated.rs | 2 +- test/autogenerated_primary_keys/models/todos/generated.rs | 2 +- test/cleanup_generated_content/models/todos/generated.rs | 2 +- test/create_update_bytes_cow/models/todos/generated.rs | 2 +- test/create_update_bytes_slice/models/todos/generated.rs | 2 +- test/create_update_str_cow/models/todos/generated.rs | 2 +- test/create_update_str_str/models/todos/generated.rs | 2 +- test/custom_model_and_schema_path/models/table_a/generated.rs | 2 +- test/custom_model_and_schema_path/models/table_b/generated.rs | 2 +- test/custom_model_path/models/table_a/generated.rs | 2 +- test/custom_model_path/models/table_b/generated.rs | 2 +- test/manual_primary_keys/models/todos/generated.rs | 2 +- test/multiple_primary_keys/models/users/generated.rs | 2 +- test/no_default_features/models/todos/generated.rs | 2 +- test/once_common_structs/models/table1/generated.rs | 2 +- test/once_common_structs/models/table2/generated.rs | 2 +- .../models/table1/generated.rs | 2 +- .../models/table2/generated.rs | 2 +- .../models/table1.rs | 2 +- .../models/table2.rs | 2 +- test/once_connection_type/models/table1/generated.rs | 2 +- test/once_connection_type/models/table2/generated.rs | 2 +- test/readonly/models/normal/generated.rs | 2 +- test/simple_table/models/todos/generated.rs | 2 +- test/simple_table_async/models/todos/generated.rs | 2 +- .../simple_table_custom_schema_path/models/todos/generated.rs | 2 +- test/simple_table_no_serde/models/todos/generated.rs | 2 +- test/single_model_file/models/table1.rs | 2 +- test/single_model_file/models/table2.rs | 2 +- test/use_statements/models/fang_tasks/generated.rs | 2 +- 32 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/code.rs b/src/code.rs index 27458c66..d4996dd5 100644 --- a/src/code.rs +++ b/src/code.rs @@ -485,7 +485,7 @@ fn build_table_fns( pub{async_keyword} fn create(db: &mut ConnectionType, item: &{create_struct_identifier}) -> QueryResult {{ use {schema_path}{table_name}::dsl::*; - insert_into({table_name}).values(item).get_result::(db){await_keyword} + diesel::insert_into({table_name}).values(item).get_result::(db){await_keyword} }} "## )); @@ -496,7 +496,7 @@ fn build_table_fns( pub{async_keyword} fn create(db: &mut ConnectionType) -> QueryResult {{ use {schema_path}{table_name}::dsl::*; - insert_into({table_name}).default_values().get_result::(db){await_keyword} + diesel::insert_into({table_name}).default_values().get_result::(db){await_keyword} }} "## )); diff --git a/test/autogenerated_all/models/todos/generated.rs b/test/autogenerated_all/models/todos/generated.rs index d0df5ab0..c239291c 100644 --- a/test/autogenerated_all/models/todos/generated.rs +++ b/test/autogenerated_all/models/todos/generated.rs @@ -44,7 +44,7 @@ impl Todos { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).default_values().get_result::(db) + diesel::insert_into(todos).default_values().get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/autogenerated_attributes/models/todos/generated.rs b/test/autogenerated_attributes/models/todos/generated.rs index 6c6bf519..25a0e917 100644 --- a/test/autogenerated_attributes/models/todos/generated.rs +++ b/test/autogenerated_attributes/models/todos/generated.rs @@ -52,7 +52,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/autogenerated_primary_keys/models/todos/generated.rs b/test/autogenerated_primary_keys/models/todos/generated.rs index 032cb47a..59d46de5 100644 --- a/test/autogenerated_primary_keys/models/todos/generated.rs +++ b/test/autogenerated_primary_keys/models/todos/generated.rs @@ -52,7 +52,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/cleanup_generated_content/models/todos/generated.rs b/test/cleanup_generated_content/models/todos/generated.rs index 98895979..6f6e8623 100644 --- a/test/cleanup_generated_content/models/todos/generated.rs +++ b/test/cleanup_generated_content/models/todos/generated.rs @@ -68,7 +68,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/create_update_bytes_cow/models/todos/generated.rs b/test/create_update_bytes_cow/models/todos/generated.rs index a62131e5..48913020 100644 --- a/test/create_update_bytes_cow/models/todos/generated.rs +++ b/test/create_update_bytes_cow/models/todos/generated.rs @@ -54,7 +54,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/create_update_bytes_slice/models/todos/generated.rs b/test/create_update_bytes_slice/models/todos/generated.rs index 57f4d475..056e9728 100644 --- a/test/create_update_bytes_slice/models/todos/generated.rs +++ b/test/create_update_bytes_slice/models/todos/generated.rs @@ -54,7 +54,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/create_update_str_cow/models/todos/generated.rs b/test/create_update_str_cow/models/todos/generated.rs index 82267e41..7248b3aa 100644 --- a/test/create_update_str_cow/models/todos/generated.rs +++ b/test/create_update_str_cow/models/todos/generated.rs @@ -66,7 +66,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/create_update_str_str/models/todos/generated.rs b/test/create_update_str_str/models/todos/generated.rs index 1f58b7b5..35714f64 100644 --- a/test/create_update_str_str/models/todos/generated.rs +++ b/test/create_update_str_str/models/todos/generated.rs @@ -66,7 +66,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/custom_model_and_schema_path/models/table_a/generated.rs b/test/custom_model_and_schema_path/models/table_a/generated.rs index ee259fda..e932f208 100644 --- a/test/custom_model_and_schema_path/models/table_a/generated.rs +++ b/test/custom_model_and_schema_path/models/table_a/generated.rs @@ -42,7 +42,7 @@ impl TableA { pub fn create(db: &mut ConnectionType, item: &CreateTableA) -> QueryResult { use crate::data::schema::tableA::dsl::*; - insert_into(tableA).values(item).get_result::(db) + diesel::insert_into(tableA).values(item).get_result::(db) } /// Get a row from `tableA`, identified by the primary key diff --git a/test/custom_model_and_schema_path/models/table_b/generated.rs b/test/custom_model_and_schema_path/models/table_b/generated.rs index d0f4b94b..fcbcef38 100644 --- a/test/custom_model_and_schema_path/models/table_b/generated.rs +++ b/test/custom_model_and_schema_path/models/table_b/generated.rs @@ -55,7 +55,7 @@ impl TableB { pub fn create(db: &mut ConnectionType, item: &CreateTableB) -> QueryResult { use crate::data::schema::tableB::dsl::*; - insert_into(tableB).values(item).get_result::(db) + diesel::insert_into(tableB).values(item).get_result::(db) } /// Get a row from `tableB`, identified by the primary key diff --git a/test/custom_model_path/models/table_a/generated.rs b/test/custom_model_path/models/table_a/generated.rs index 38fe8a59..a3821c83 100644 --- a/test/custom_model_path/models/table_a/generated.rs +++ b/test/custom_model_path/models/table_a/generated.rs @@ -42,7 +42,7 @@ impl TableA { pub fn create(db: &mut ConnectionType, item: &CreateTableA) -> QueryResult { use crate::schema::tableA::dsl::*; - insert_into(tableA).values(item).get_result::(db) + diesel::insert_into(tableA).values(item).get_result::(db) } /// Get a row from `tableA`, identified by the primary key diff --git a/test/custom_model_path/models/table_b/generated.rs b/test/custom_model_path/models/table_b/generated.rs index 55fbd549..f286d82c 100644 --- a/test/custom_model_path/models/table_b/generated.rs +++ b/test/custom_model_path/models/table_b/generated.rs @@ -55,7 +55,7 @@ impl TableB { pub fn create(db: &mut ConnectionType, item: &CreateTableB) -> QueryResult { use crate::schema::tableB::dsl::*; - insert_into(tableB).values(item).get_result::(db) + diesel::insert_into(tableB).values(item).get_result::(db) } /// Get a row from `tableB`, identified by the primary key diff --git a/test/manual_primary_keys/models/todos/generated.rs b/test/manual_primary_keys/models/todos/generated.rs index 8e7bedc3..5efab081 100644 --- a/test/manual_primary_keys/models/todos/generated.rs +++ b/test/manual_primary_keys/models/todos/generated.rs @@ -42,7 +42,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/multiple_primary_keys/models/users/generated.rs b/test/multiple_primary_keys/models/users/generated.rs index bd990300..f770c890 100644 --- a/test/multiple_primary_keys/models/users/generated.rs +++ b/test/multiple_primary_keys/models/users/generated.rs @@ -58,7 +58,7 @@ impl Users { pub fn create(db: &mut ConnectionType, item: &CreateUsers) -> QueryResult { use crate::schema::users::dsl::*; - insert_into(users).values(item).get_result::(db) + diesel::insert_into(users).values(item).get_result::(db) } /// Get a row from `users`, identified by the primary keys diff --git a/test/no_default_features/models/todos/generated.rs b/test/no_default_features/models/todos/generated.rs index d4be42bd..79d12379 100644 --- a/test/no_default_features/models/todos/generated.rs +++ b/test/no_default_features/models/todos/generated.rs @@ -84,7 +84,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/once_common_structs/models/table1/generated.rs b/test/once_common_structs/models/table1/generated.rs index ada81b32..d217e5d3 100644 --- a/test/once_common_structs/models/table1/generated.rs +++ b/test/once_common_structs/models/table1/generated.rs @@ -20,7 +20,7 @@ impl Table1 { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::table1::dsl::*; - insert_into(table1).default_values().get_result::(db) + diesel::insert_into(table1).default_values().get_result::(db) } /// Get a row from `table1`, identified by the primary key diff --git a/test/once_common_structs/models/table2/generated.rs b/test/once_common_structs/models/table2/generated.rs index 3fb531c2..3552acd1 100644 --- a/test/once_common_structs/models/table2/generated.rs +++ b/test/once_common_structs/models/table2/generated.rs @@ -20,7 +20,7 @@ impl Table2 { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::table2::dsl::*; - insert_into(table2).default_values().get_result::(db) + diesel::insert_into(table2).default_values().get_result::(db) } /// Get a row from `table2`, identified by the primary key diff --git a/test/once_common_structs_once_connection_type/models/table1/generated.rs b/test/once_common_structs_once_connection_type/models/table1/generated.rs index db18bfaa..d20e2ce0 100644 --- a/test/once_common_structs_once_connection_type/models/table1/generated.rs +++ b/test/once_common_structs_once_connection_type/models/table1/generated.rs @@ -18,7 +18,7 @@ impl Table1 { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::table1::dsl::*; - insert_into(table1).default_values().get_result::(db) + diesel::insert_into(table1).default_values().get_result::(db) } /// Get a row from `table1`, identified by the primary key diff --git a/test/once_common_structs_once_connection_type/models/table2/generated.rs b/test/once_common_structs_once_connection_type/models/table2/generated.rs index fba33e63..b3b9f6b7 100644 --- a/test/once_common_structs_once_connection_type/models/table2/generated.rs +++ b/test/once_common_structs_once_connection_type/models/table2/generated.rs @@ -18,7 +18,7 @@ impl Table2 { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::table2::dsl::*; - insert_into(table2).default_values().get_result::(db) + diesel::insert_into(table2).default_values().get_result::(db) } /// Get a row from `table2`, identified by the primary key diff --git a/test/once_common_structs_once_connection_type_single_file/models/table1.rs b/test/once_common_structs_once_connection_type_single_file/models/table1.rs index db18bfaa..d20e2ce0 100644 --- a/test/once_common_structs_once_connection_type_single_file/models/table1.rs +++ b/test/once_common_structs_once_connection_type_single_file/models/table1.rs @@ -18,7 +18,7 @@ impl Table1 { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::table1::dsl::*; - insert_into(table1).default_values().get_result::(db) + diesel::insert_into(table1).default_values().get_result::(db) } /// Get a row from `table1`, identified by the primary key diff --git a/test/once_common_structs_once_connection_type_single_file/models/table2.rs b/test/once_common_structs_once_connection_type_single_file/models/table2.rs index fba33e63..b3b9f6b7 100644 --- a/test/once_common_structs_once_connection_type_single_file/models/table2.rs +++ b/test/once_common_structs_once_connection_type_single_file/models/table2.rs @@ -18,7 +18,7 @@ impl Table2 { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::table2::dsl::*; - insert_into(table2).default_values().get_result::(db) + diesel::insert_into(table2).default_values().get_result::(db) } /// Get a row from `table2`, identified by the primary key diff --git a/test/once_connection_type/models/table1/generated.rs b/test/once_connection_type/models/table1/generated.rs index ebf5d096..88b823ff 100644 --- a/test/once_connection_type/models/table1/generated.rs +++ b/test/once_connection_type/models/table1/generated.rs @@ -33,7 +33,7 @@ impl Table1 { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::table1::dsl::*; - insert_into(table1).default_values().get_result::(db) + diesel::insert_into(table1).default_values().get_result::(db) } /// Get a row from `table1`, identified by the primary key diff --git a/test/once_connection_type/models/table2/generated.rs b/test/once_connection_type/models/table2/generated.rs index de1f66d5..63300aca 100644 --- a/test/once_connection_type/models/table2/generated.rs +++ b/test/once_connection_type/models/table2/generated.rs @@ -33,7 +33,7 @@ impl Table2 { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::table2::dsl::*; - insert_into(table2).default_values().get_result::(db) + diesel::insert_into(table2).default_values().get_result::(db) } /// Get a row from `table2`, identified by the primary key diff --git a/test/readonly/models/normal/generated.rs b/test/readonly/models/normal/generated.rs index 134ed36c..cb70d7c4 100644 --- a/test/readonly/models/normal/generated.rs +++ b/test/readonly/models/normal/generated.rs @@ -52,7 +52,7 @@ impl Normal { pub fn create(db: &mut ConnectionType, item: &CreateNormal) -> QueryResult { use crate::schema::normal::dsl::*; - insert_into(normal).values(item).get_result::(db) + diesel::insert_into(normal).values(item).get_result::(db) } /// Get a row from `normal`, identified by the primary key diff --git a/test/simple_table/models/todos/generated.rs b/test/simple_table/models/todos/generated.rs index 5af259ec..65024f60 100644 --- a/test/simple_table/models/todos/generated.rs +++ b/test/simple_table/models/todos/generated.rs @@ -84,7 +84,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/simple_table_async/models/todos/generated.rs b/test/simple_table_async/models/todos/generated.rs index 1977be43..0086c514 100644 --- a/test/simple_table_async/models/todos/generated.rs +++ b/test/simple_table_async/models/todos/generated.rs @@ -73,7 +73,7 @@ impl Todos { pub async fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db).await + diesel::insert_into(todos).values(item).get_result::(db).await } /// Get a row from `todos`, identified by the primary key diff --git a/test/simple_table_custom_schema_path/models/todos/generated.rs b/test/simple_table_custom_schema_path/models/todos/generated.rs index b9109d82..8f11ef29 100644 --- a/test/simple_table_custom_schema_path/models/todos/generated.rs +++ b/test/simple_table_custom_schema_path/models/todos/generated.rs @@ -72,7 +72,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::data::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/simple_table_no_serde/models/todos/generated.rs b/test/simple_table_no_serde/models/todos/generated.rs index f6fd77b7..164256c4 100644 --- a/test/simple_table_no_serde/models/todos/generated.rs +++ b/test/simple_table_no_serde/models/todos/generated.rs @@ -72,7 +72,7 @@ impl Todos { pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { use crate::schema::todos::dsl::*; - insert_into(todos).values(item).get_result::(db) + diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key diff --git a/test/single_model_file/models/table1.rs b/test/single_model_file/models/table1.rs index 23b75ef1..2e7ae446 100644 --- a/test/single_model_file/models/table1.rs +++ b/test/single_model_file/models/table1.rs @@ -34,7 +34,7 @@ impl Table1 { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::table1::dsl::*; - insert_into(table1).default_values().get_result::(db) + diesel::insert_into(table1).default_values().get_result::(db) } /// Get a row from `table1`, identified by the primary key diff --git a/test/single_model_file/models/table2.rs b/test/single_model_file/models/table2.rs index 863aa4fc..63fbd0fa 100644 --- a/test/single_model_file/models/table2.rs +++ b/test/single_model_file/models/table2.rs @@ -34,7 +34,7 @@ impl Table2 { pub fn create(db: &mut ConnectionType) -> QueryResult { use crate::schema::table2::dsl::*; - insert_into(table2).default_values().get_result::(db) + diesel::insert_into(table2).default_values().get_result::(db) } /// Get a row from `table2`, identified by the primary key diff --git a/test/use_statements/models/fang_tasks/generated.rs b/test/use_statements/models/fang_tasks/generated.rs index b2e2dc9f..ad3c06b6 100644 --- a/test/use_statements/models/fang_tasks/generated.rs +++ b/test/use_statements/models/fang_tasks/generated.rs @@ -102,7 +102,7 @@ impl FangTasks { pub fn create(db: &mut ConnectionType, item: &CreateFangTasks) -> QueryResult { use crate::schema::fang_tasks::dsl::*; - insert_into(fang_tasks).values(item).get_result::(db) + diesel::insert_into(fang_tasks).values(item).get_result::(db) } /// Get a row from `fang_tasks`, identified by the primary key From 0a555563847557760d9bf6b74318104af419e4d5 Mon Sep 17 00:00:00 2001 From: hasezoey Date: Mon, 11 Dec 2023 17:39:09 +0100 Subject: [PATCH 3/3] feat(code): change function return types to use "diesel::" prefix" and remove explicit import --- src/code.rs | 16 ++++++---------- test/autogenerated_all/models/todos/generated.rs | 11 +++++------ .../models/todos/generated.rs | 11 +++++------ .../models/todos/generated.rs | 11 +++++------ .../models/todos/generated.rs | 11 +++++------ .../models/todos/generated.rs | 11 +++++------ .../models/todos/generated.rs | 11 +++++------ .../models/todos/generated.rs | 11 +++++------ .../models/todos/generated.rs | 11 +++++------ .../models/table_a/generated.rs | 9 ++++----- .../models/table_b/generated.rs | 11 +++++------ .../models/table_a/generated.rs | 9 ++++----- .../models/table_b/generated.rs | 11 +++++------ .../models/todos/generated.rs | 9 ++++----- .../models/users/generated.rs | 11 +++++------ .../models/todos/generated.rs | 11 +++++------ .../models/table1/generated.rs | 9 ++++----- .../models/table2/generated.rs | 9 ++++----- .../models/table1/generated.rs | 9 ++++----- .../models/table2/generated.rs | 9 ++++----- .../models/table1.rs | 9 ++++----- .../models/table2.rs | 9 ++++----- .../models/table1/generated.rs | 9 ++++----- .../models/table2/generated.rs | 9 ++++----- test/readonly/models/normal/generated.rs | 11 +++++------ test/readonly/models/prefix_table/generated.rs | 5 ++--- .../models/prefix_table_suffix/generated.rs | 5 ++--- test/readonly/models/table_suffix/generated.rs | 5 ++--- test/simple_table/models/todos/generated.rs | 11 +++++------ .../simple_table_async/models/todos/generated.rs | 11 +++++------ .../models/todos/generated.rs | 11 +++++------ .../models/todos/generated.rs | 11 +++++------ test/single_model_file/models/table1.rs | 9 ++++----- test/single_model_file/models/table2.rs | 9 ++++----- .../models/fang_tasks/generated.rs | 11 +++++------ 35 files changed, 154 insertions(+), 192 deletions(-) diff --git a/src/code.rs b/src/code.rs index d4996dd5..01f0fc6f 100644 --- a/src/code.rs +++ b/src/code.rs @@ -482,7 +482,7 @@ fn build_table_fns( buffer.push_str(&format!( r##" /// Insert a new row into `{table_name}` with a given [`{create_struct_identifier}`] - pub{async_keyword} fn create(db: &mut ConnectionType, item: &{create_struct_identifier}) -> QueryResult {{ + pub{async_keyword} fn create(db: &mut ConnectionType, item: &{create_struct_identifier}) -> diesel::QueryResult {{ use {schema_path}{table_name}::dsl::*; diesel::insert_into({table_name}).values(item).get_result::(db){await_keyword} @@ -493,7 +493,7 @@ fn build_table_fns( buffer.push_str(&format!( r##" /// Insert a new row into `{table_name}` with all default values - pub{async_keyword} fn create(db: &mut ConnectionType) -> QueryResult {{ + pub{async_keyword} fn create(db: &mut ConnectionType) -> diesel::QueryResult {{ use {schema_path}{table_name}::dsl::*; diesel::insert_into({table_name}).default_values().get_result::(db){await_keyword} @@ -513,7 +513,7 @@ fn build_table_fns( buffer.push_str(&format!( r##" /// Get a row from `{table_name}`, identified by the primary {key_maybe_multiple} - pub{async_keyword} fn read(db: &mut ConnectionType, {item_id_params}) -> QueryResult {{ + pub{async_keyword} fn read(db: &mut ConnectionType, {item_id_params}) -> diesel::QueryResult {{ use {schema_path}{table_name}::dsl::*; {table_name}.{item_id_filters}.first::(db){await_keyword} @@ -523,7 +523,7 @@ fn build_table_fns( buffer.push_str(&format!(r##" /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub{async_keyword} fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> {{ + pub{async_keyword} fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> {{ use {schema_path}{table_name}::dsl::*; let page_size = if page_size < 1 {{ 1 }} else {{ page_size }}; @@ -552,7 +552,7 @@ fn build_table_fns( buffer.push_str(&format!(r##" /// Update a row in `{table_name}`, identified by the primary {key_maybe_multiple} with [`{update_struct_identifier}`] - pub{async_keyword} fn update(db: &mut ConnectionType, {item_id_params}, item: &{update_struct_identifier}) -> QueryResult {{ + pub{async_keyword} fn update(db: &mut ConnectionType, {item_id_params}, item: &{update_struct_identifier}) -> diesel::QueryResult {{ use {schema_path}{table_name}::dsl::*; diesel::update({table_name}.{item_id_filters}).set(item).get_result(db){await_keyword} @@ -564,7 +564,7 @@ fn build_table_fns( buffer.push_str(&format!( r##" /// Delete a row in `{table_name}`, identified by the primary {key_maybe_multiple} - pub{async_keyword} fn delete(db: &mut ConnectionType, {item_id_params}) -> QueryResult {{ + pub{async_keyword} fn delete(db: &mut ConnectionType, {item_id_params}) -> diesel::QueryResult {{ use {schema_path}{table_name}::dsl::*; diesel::delete({table_name}.{item_id_filters}).execute(db){await_keyword} @@ -646,10 +646,6 @@ fn build_imports(table: &ParsedTableMacro, config: &GenerationConfig) -> String // no "::" because that is already included in the schema_path imports_vec.push(format!("use {}*;", config.schema_path)); - if table_options.get_fns() { - imports_vec.push("use diesel::QueryResult;".into()); - }; - if config.once_common_structs || config.once_connection_type { imports_vec.push(format!("use {}common::*;", config.model_path)); }; diff --git a/test/autogenerated_all/models/todos/generated.rs b/test/autogenerated_all/models/todos/generated.rs index c239291c..c95c56dd 100644 --- a/test/autogenerated_all/models/todos/generated.rs +++ b/test/autogenerated_all/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -41,21 +40,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).default_values().get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -73,14 +72,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(id.eq(param_id))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(id.eq(param_id))).execute(db) diff --git a/test/autogenerated_attributes/models/todos/generated.rs b/test/autogenerated_attributes/models/todos/generated.rs index 25a0e917..d9e3d9dc 100644 --- a/test/autogenerated_attributes/models/todos/generated.rs +++ b/test/autogenerated_attributes/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -49,21 +48,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -81,14 +80,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(id.eq(param_id))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(id.eq(param_id))).execute(db) diff --git a/test/autogenerated_primary_keys/models/todos/generated.rs b/test/autogenerated_primary_keys/models/todos/generated.rs index 59d46de5..67a76628 100644 --- a/test/autogenerated_primary_keys/models/todos/generated.rs +++ b/test/autogenerated_primary_keys/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -49,21 +48,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -81,14 +80,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(id.eq(param_id))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(id.eq(param_id))).execute(db) diff --git a/test/cleanup_generated_content/models/todos/generated.rs b/test/cleanup_generated_content/models/todos/generated.rs index 6f6e8623..aceaeb41 100644 --- a/test/cleanup_generated_content/models/todos/generated.rs +++ b/test/cleanup_generated_content/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -65,21 +64,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -97,14 +96,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(id.eq(param_id))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(id.eq(param_id))).execute(db) diff --git a/test/create_update_bytes_cow/models/todos/generated.rs b/test/create_update_bytes_cow/models/todos/generated.rs index 48913020..a7ee8464 100644 --- a/test/create_update_bytes_cow/models/todos/generated.rs +++ b/test/create_update_bytes_cow/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -51,21 +50,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_data: Vec) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_data: Vec) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(data.eq(param_data)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -83,14 +82,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_data: Vec, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_data: Vec, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(data.eq(param_data))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_data: Vec) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_data: Vec) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(data.eq(param_data))).execute(db) diff --git a/test/create_update_bytes_slice/models/todos/generated.rs b/test/create_update_bytes_slice/models/todos/generated.rs index 056e9728..07cb96a4 100644 --- a/test/create_update_bytes_slice/models/todos/generated.rs +++ b/test/create_update_bytes_slice/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -51,21 +50,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_data: Vec) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_data: Vec) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(data.eq(param_data)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -83,14 +82,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_data: Vec, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_data: Vec, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(data.eq(param_data))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_data: Vec) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_data: Vec) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(data.eq(param_data))).execute(db) diff --git a/test/create_update_str_cow/models/todos/generated.rs b/test/create_update_str_cow/models/todos/generated.rs index 7248b3aa..6f0c6fc0 100644 --- a/test/create_update_str_cow/models/todos/generated.rs +++ b/test/create_update_str_cow/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -63,21 +62,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_text: String) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_text: String) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(text.eq(param_text)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -95,14 +94,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_text: String, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_text: String, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(text.eq(param_text))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_text: String) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_text: String) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(text.eq(param_text))).execute(db) diff --git a/test/create_update_str_str/models/todos/generated.rs b/test/create_update_str_str/models/todos/generated.rs index 35714f64..e020e1c3 100644 --- a/test/create_update_str_str/models/todos/generated.rs +++ b/test/create_update_str_str/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -63,21 +62,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_text: String) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_text: String) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(text.eq(param_text)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -95,14 +94,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_text: String, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_text: String, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(text.eq(param_text))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_text: String) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_text: String) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(text.eq(param_text))).execute(db) diff --git a/test/custom_model_and_schema_path/models/table_a/generated.rs b/test/custom_model_and_schema_path/models/table_a/generated.rs index e932f208..e189aaff 100644 --- a/test/custom_model_and_schema_path/models/table_a/generated.rs +++ b/test/custom_model_and_schema_path/models/table_a/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::data::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -39,21 +38,21 @@ pub struct PaginationResult { impl TableA { /// Insert a new row into `tableA` with a given [`CreateTableA`] - pub fn create(db: &mut ConnectionType, item: &CreateTableA) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTableA) -> diesel::QueryResult { use crate::data::schema::tableA::dsl::*; diesel::insert_into(tableA).values(item).get_result::(db) } /// Get a row from `tableA`, identified by the primary key - pub fn read(db: &mut ConnectionType, param__id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param__id: i32) -> diesel::QueryResult { use crate::data::schema::tableA::dsl::*; tableA.filter(_id.eq(param__id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::data::schema::tableA::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -71,7 +70,7 @@ impl TableA { } /// Delete a row in `tableA`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param__id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param__id: i32) -> diesel::QueryResult { use crate::data::schema::tableA::dsl::*; diesel::delete(tableA.filter(_id.eq(param__id))).execute(db) diff --git a/test/custom_model_and_schema_path/models/table_b/generated.rs b/test/custom_model_and_schema_path/models/table_b/generated.rs index fcbcef38..d48aead6 100644 --- a/test/custom_model_and_schema_path/models/table_b/generated.rs +++ b/test/custom_model_and_schema_path/models/table_b/generated.rs @@ -3,7 +3,6 @@ use crate::diesel::*; use crate::data::models::table_a::TableA; use crate::data::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -52,21 +51,21 @@ pub struct PaginationResult { impl TableB { /// Insert a new row into `tableB` with a given [`CreateTableB`] - pub fn create(db: &mut ConnectionType, item: &CreateTableB) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTableB) -> diesel::QueryResult { use crate::data::schema::tableB::dsl::*; diesel::insert_into(tableB).values(item).get_result::(db) } /// Get a row from `tableB`, identified by the primary key - pub fn read(db: &mut ConnectionType, param__id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param__id: i32) -> diesel::QueryResult { use crate::data::schema::tableB::dsl::*; tableB.filter(_id.eq(param__id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::data::schema::tableB::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -84,14 +83,14 @@ impl TableB { } /// Update a row in `tableB`, identified by the primary key with [`UpdateTableB`] - pub fn update(db: &mut ConnectionType, param__id: i32, item: &UpdateTableB) -> QueryResult { + pub fn update(db: &mut ConnectionType, param__id: i32, item: &UpdateTableB) -> diesel::QueryResult { use crate::data::schema::tableB::dsl::*; diesel::update(tableB.filter(_id.eq(param__id))).set(item).get_result(db) } /// Delete a row in `tableB`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param__id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param__id: i32) -> diesel::QueryResult { use crate::data::schema::tableB::dsl::*; diesel::delete(tableB.filter(_id.eq(param__id))).execute(db) diff --git a/test/custom_model_path/models/table_a/generated.rs b/test/custom_model_path/models/table_a/generated.rs index a3821c83..1855353f 100644 --- a/test/custom_model_path/models/table_a/generated.rs +++ b/test/custom_model_path/models/table_a/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -39,21 +38,21 @@ pub struct PaginationResult { impl TableA { /// Insert a new row into `tableA` with a given [`CreateTableA`] - pub fn create(db: &mut ConnectionType, item: &CreateTableA) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTableA) -> diesel::QueryResult { use crate::schema::tableA::dsl::*; diesel::insert_into(tableA).values(item).get_result::(db) } /// Get a row from `tableA`, identified by the primary key - pub fn read(db: &mut ConnectionType, param__id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param__id: i32) -> diesel::QueryResult { use crate::schema::tableA::dsl::*; tableA.filter(_id.eq(param__id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::tableA::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -71,7 +70,7 @@ impl TableA { } /// Delete a row in `tableA`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param__id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param__id: i32) -> diesel::QueryResult { use crate::schema::tableA::dsl::*; diesel::delete(tableA.filter(_id.eq(param__id))).execute(db) diff --git a/test/custom_model_path/models/table_b/generated.rs b/test/custom_model_path/models/table_b/generated.rs index f286d82c..2a848832 100644 --- a/test/custom_model_path/models/table_b/generated.rs +++ b/test/custom_model_path/models/table_b/generated.rs @@ -3,7 +3,6 @@ use crate::diesel::*; use crate::data::models::table_a::TableA; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -52,21 +51,21 @@ pub struct PaginationResult { impl TableB { /// Insert a new row into `tableB` with a given [`CreateTableB`] - pub fn create(db: &mut ConnectionType, item: &CreateTableB) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTableB) -> diesel::QueryResult { use crate::schema::tableB::dsl::*; diesel::insert_into(tableB).values(item).get_result::(db) } /// Get a row from `tableB`, identified by the primary key - pub fn read(db: &mut ConnectionType, param__id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param__id: i32) -> diesel::QueryResult { use crate::schema::tableB::dsl::*; tableB.filter(_id.eq(param__id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::tableB::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -84,14 +83,14 @@ impl TableB { } /// Update a row in `tableB`, identified by the primary key with [`UpdateTableB`] - pub fn update(db: &mut ConnectionType, param__id: i32, item: &UpdateTableB) -> QueryResult { + pub fn update(db: &mut ConnectionType, param__id: i32, item: &UpdateTableB) -> diesel::QueryResult { use crate::schema::tableB::dsl::*; diesel::update(tableB.filter(_id.eq(param__id))).set(item).get_result(db) } /// Delete a row in `tableB`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param__id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param__id: i32) -> diesel::QueryResult { use crate::schema::tableB::dsl::*; diesel::delete(tableB.filter(_id.eq(param__id))).execute(db) diff --git a/test/manual_primary_keys/models/todos/generated.rs b/test/manual_primary_keys/models/todos/generated.rs index 5efab081..2c91b48a 100644 --- a/test/manual_primary_keys/models/todos/generated.rs +++ b/test/manual_primary_keys/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -39,21 +38,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -71,7 +70,7 @@ impl Todos { } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(id.eq(param_id))).execute(db) diff --git a/test/multiple_primary_keys/models/users/generated.rs b/test/multiple_primary_keys/models/users/generated.rs index f770c890..46a6192a 100644 --- a/test/multiple_primary_keys/models/users/generated.rs +++ b/test/multiple_primary_keys/models/users/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -55,21 +54,21 @@ pub struct PaginationResult { impl Users { /// Insert a new row into `users` with a given [`CreateUsers`] - pub fn create(db: &mut ConnectionType, item: &CreateUsers) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateUsers) -> diesel::QueryResult { use crate::schema::users::dsl::*; diesel::insert_into(users).values(item).get_result::(db) } /// Get a row from `users`, identified by the primary keys - pub fn read(db: &mut ConnectionType, param_name: String, param_address: String) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_name: String, param_address: String) -> diesel::QueryResult { use crate::schema::users::dsl::*; users.filter(name.eq(param_name)).filter(address.eq(param_address)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::users::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -87,14 +86,14 @@ impl Users { } /// Update a row in `users`, identified by the primary keys with [`UpdateUsers`] - pub fn update(db: &mut ConnectionType, param_name: String, param_address: String, item: &UpdateUsers) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_name: String, param_address: String, item: &UpdateUsers) -> diesel::QueryResult { use crate::schema::users::dsl::*; diesel::update(users.filter(name.eq(param_name)).filter(address.eq(param_address))).set(item).get_result(db) } /// Delete a row in `users`, identified by the primary keys - pub fn delete(db: &mut ConnectionType, param_name: String, param_address: String) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_name: String, param_address: String) -> diesel::QueryResult { use crate::schema::users::dsl::*; diesel::delete(users.filter(name.eq(param_name)).filter(address.eq(param_address))).execute(db) diff --git a/test/no_default_features/models/todos/generated.rs b/test/no_default_features/models/todos/generated.rs index 79d12379..f734cd5a 100644 --- a/test/no_default_features/models/todos/generated.rs +++ b/test/no_default_features/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -81,21 +80,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -113,14 +112,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(id.eq(param_id))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(id.eq(param_id))).execute(db) diff --git a/test/once_common_structs/models/table1/generated.rs b/test/once_common_structs/models/table1/generated.rs index d217e5d3..5bd29d89 100644 --- a/test/once_common_structs/models/table1/generated.rs +++ b/test/once_common_structs/models/table1/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; use crate::models::common::*; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -17,21 +16,21 @@ pub struct Table1 { impl Table1 { /// Insert a new row into `table1` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::table1::dsl::*; diesel::insert_into(table1).default_values().get_result::(db) } /// Get a row from `table1`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table1::dsl::*; table1.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::table1::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -49,7 +48,7 @@ impl Table1 { } /// Delete a row in `table1`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table1::dsl::*; diesel::delete(table1.filter(id.eq(param_id))).execute(db) diff --git a/test/once_common_structs/models/table2/generated.rs b/test/once_common_structs/models/table2/generated.rs index 3552acd1..af9b5fac 100644 --- a/test/once_common_structs/models/table2/generated.rs +++ b/test/once_common_structs/models/table2/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; use crate::models::common::*; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -17,21 +16,21 @@ pub struct Table2 { impl Table2 { /// Insert a new row into `table2` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::table2::dsl::*; diesel::insert_into(table2).default_values().get_result::(db) } /// Get a row from `table2`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table2::dsl::*; table2.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::table2::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -49,7 +48,7 @@ impl Table2 { } /// Delete a row in `table2`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table2::dsl::*; diesel::delete(table2.filter(id.eq(param_id))).execute(db) diff --git a/test/once_common_structs_once_connection_type/models/table1/generated.rs b/test/once_common_structs_once_connection_type/models/table1/generated.rs index d20e2ce0..30b6860f 100644 --- a/test/once_common_structs_once_connection_type/models/table1/generated.rs +++ b/test/once_common_structs_once_connection_type/models/table1/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table1` @@ -15,21 +14,21 @@ pub struct Table1 { impl Table1 { /// Insert a new row into `table1` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::table1::dsl::*; diesel::insert_into(table1).default_values().get_result::(db) } /// Get a row from `table1`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table1::dsl::*; table1.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::table1::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -47,7 +46,7 @@ impl Table1 { } /// Delete a row in `table1`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table1::dsl::*; diesel::delete(table1.filter(id.eq(param_id))).execute(db) diff --git a/test/once_common_structs_once_connection_type/models/table2/generated.rs b/test/once_common_structs_once_connection_type/models/table2/generated.rs index b3b9f6b7..7fb5035c 100644 --- a/test/once_common_structs_once_connection_type/models/table2/generated.rs +++ b/test/once_common_structs_once_connection_type/models/table2/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table2` @@ -15,21 +14,21 @@ pub struct Table2 { impl Table2 { /// Insert a new row into `table2` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::table2::dsl::*; diesel::insert_into(table2).default_values().get_result::(db) } /// Get a row from `table2`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table2::dsl::*; table2.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::table2::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -47,7 +46,7 @@ impl Table2 { } /// Delete a row in `table2`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table2::dsl::*; diesel::delete(table2.filter(id.eq(param_id))).execute(db) diff --git a/test/once_common_structs_once_connection_type_single_file/models/table1.rs b/test/once_common_structs_once_connection_type_single_file/models/table1.rs index d20e2ce0..30b6860f 100644 --- a/test/once_common_structs_once_connection_type_single_file/models/table1.rs +++ b/test/once_common_structs_once_connection_type_single_file/models/table1.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table1` @@ -15,21 +14,21 @@ pub struct Table1 { impl Table1 { /// Insert a new row into `table1` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::table1::dsl::*; diesel::insert_into(table1).default_values().get_result::(db) } /// Get a row from `table1`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table1::dsl::*; table1.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::table1::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -47,7 +46,7 @@ impl Table1 { } /// Delete a row in `table1`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table1::dsl::*; diesel::delete(table1.filter(id.eq(param_id))).execute(db) diff --git a/test/once_common_structs_once_connection_type_single_file/models/table2.rs b/test/once_common_structs_once_connection_type_single_file/models/table2.rs index b3b9f6b7..7fb5035c 100644 --- a/test/once_common_structs_once_connection_type_single_file/models/table2.rs +++ b/test/once_common_structs_once_connection_type_single_file/models/table2.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table2` @@ -15,21 +14,21 @@ pub struct Table2 { impl Table2 { /// Insert a new row into `table2` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::table2::dsl::*; diesel::insert_into(table2).default_values().get_result::(db) } /// Get a row from `table2`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table2::dsl::*; table2.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::table2::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -47,7 +46,7 @@ impl Table2 { } /// Delete a row in `table2`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table2::dsl::*; diesel::delete(table2.filter(id.eq(param_id))).execute(db) diff --git a/test/once_connection_type/models/table1/generated.rs b/test/once_connection_type/models/table1/generated.rs index 88b823ff..114f019c 100644 --- a/test/once_connection_type/models/table1/generated.rs +++ b/test/once_connection_type/models/table1/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table1` @@ -30,21 +29,21 @@ pub struct PaginationResult { impl Table1 { /// Insert a new row into `table1` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::table1::dsl::*; diesel::insert_into(table1).default_values().get_result::(db) } /// Get a row from `table1`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table1::dsl::*; table1.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::table1::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -62,7 +61,7 @@ impl Table1 { } /// Delete a row in `table1`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table1::dsl::*; diesel::delete(table1.filter(id.eq(param_id))).execute(db) diff --git a/test/once_connection_type/models/table2/generated.rs b/test/once_connection_type/models/table2/generated.rs index 63300aca..ca83f780 100644 --- a/test/once_connection_type/models/table2/generated.rs +++ b/test/once_connection_type/models/table2/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; use crate::models::common::*; /// Struct representing a row in table `table2` @@ -30,21 +29,21 @@ pub struct PaginationResult { impl Table2 { /// Insert a new row into `table2` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::table2::dsl::*; diesel::insert_into(table2).default_values().get_result::(db) } /// Get a row from `table2`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table2::dsl::*; table2.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::table2::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -62,7 +61,7 @@ impl Table2 { } /// Delete a row in `table2`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table2::dsl::*; diesel::delete(table2.filter(id.eq(param_id))).execute(db) diff --git a/test/readonly/models/normal/generated.rs b/test/readonly/models/normal/generated.rs index cb70d7c4..08bb99aa 100644 --- a/test/readonly/models/normal/generated.rs +++ b/test/readonly/models/normal/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -49,21 +48,21 @@ pub struct PaginationResult { impl Normal { /// Insert a new row into `normal` with a given [`CreateNormal`] - pub fn create(db: &mut ConnectionType, item: &CreateNormal) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateNormal) -> diesel::QueryResult { use crate::schema::normal::dsl::*; diesel::insert_into(normal).values(item).get_result::(db) } /// Get a row from `normal`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::normal::dsl::*; normal.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::normal::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -81,14 +80,14 @@ impl Normal { } /// Update a row in `normal`, identified by the primary key with [`UpdateNormal`] - pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateNormal) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateNormal) -> diesel::QueryResult { use crate::schema::normal::dsl::*; diesel::update(normal.filter(id.eq(param_id))).set(item).get_result(db) } /// Delete a row in `normal`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::normal::dsl::*; diesel::delete(normal.filter(id.eq(param_id))).execute(db) diff --git a/test/readonly/models/prefix_table/generated.rs b/test/readonly/models/prefix_table/generated.rs index 0e854452..9f5bf802 100644 --- a/test/readonly/models/prefix_table/generated.rs +++ b/test/readonly/models/prefix_table/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -33,14 +32,14 @@ pub struct PaginationResult { impl PrefixTable { /// Get a row from `prefixTable`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::prefixTable::dsl::*; prefixTable.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::prefixTable::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; diff --git a/test/readonly/models/prefix_table_suffix/generated.rs b/test/readonly/models/prefix_table_suffix/generated.rs index def11620..6e0e86b8 100644 --- a/test/readonly/models/prefix_table_suffix/generated.rs +++ b/test/readonly/models/prefix_table_suffix/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -33,14 +32,14 @@ pub struct PaginationResult { impl PrefixTableSuffix { /// Get a row from `prefixTableSuffix`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::prefixTableSuffix::dsl::*; prefixTableSuffix.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::prefixTableSuffix::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; diff --git a/test/readonly/models/table_suffix/generated.rs b/test/readonly/models/table_suffix/generated.rs index c2dbc0f6..cd7ab188 100644 --- a/test/readonly/models/table_suffix/generated.rs +++ b/test/readonly/models/table_suffix/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -33,14 +32,14 @@ pub struct PaginationResult { impl TableSuffix { /// Get a row from `tableSuffix`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::tableSuffix::dsl::*; tableSuffix.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::tableSuffix::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; diff --git a/test/simple_table/models/todos/generated.rs b/test/simple_table/models/todos/generated.rs index 65024f60..05aa49e7 100644 --- a/test/simple_table/models/todos/generated.rs +++ b/test/simple_table/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -81,21 +80,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -113,14 +112,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(id.eq(param_id))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(id.eq(param_id))).execute(db) diff --git a/test/simple_table_async/models/todos/generated.rs b/test/simple_table_async/models/todos/generated.rs index 0086c514..6eeb56e5 100644 --- a/test/simple_table_async/models/todos/generated.rs +++ b/test/simple_table_async/models/todos/generated.rs @@ -3,7 +3,6 @@ use crate::diesel::*; use diesel_async::RunQueryDsl; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel_async::pooled_connection::deadpool::Object; @@ -70,21 +69,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub async fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub async fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db).await } /// Get a row from `todos`, identified by the primary key - pub async fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub async fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(id.eq(param_id)).first::(db).await } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub async fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub async fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -102,14 +101,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub async fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> QueryResult { + pub async fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(id.eq(param_id))).set(item).get_result(db).await } /// Delete a row in `todos`, identified by the primary key - pub async fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub async fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(id.eq(param_id))).execute(db).await diff --git a/test/simple_table_custom_schema_path/models/todos/generated.rs b/test/simple_table_custom_schema_path/models/todos/generated.rs index 8f11ef29..e24e9228 100644 --- a/test/simple_table_custom_schema_path/models/todos/generated.rs +++ b/test/simple_table_custom_schema_path/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::data::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -69,21 +68,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::data::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::data::schema::todos::dsl::*; todos.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::data::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -101,14 +100,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> diesel::QueryResult { use crate::data::schema::todos::dsl::*; diesel::update(todos.filter(id.eq(param_id))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::data::schema::todos::dsl::*; diesel::delete(todos.filter(id.eq(param_id))).execute(db) diff --git a/test/simple_table_no_serde/models/todos/generated.rs b/test/simple_table_no_serde/models/todos/generated.rs index 164256c4..45adb060 100644 --- a/test/simple_table_no_serde/models/todos/generated.rs +++ b/test/simple_table_no_serde/models/todos/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -69,21 +68,21 @@ pub struct PaginationResult { impl Todos { /// Insert a new row into `todos` with a given [`CreateTodos`] - pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::insert_into(todos).values(item).get_result::(db) } /// Get a row from `todos`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; todos.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::todos::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -101,14 +100,14 @@ impl Todos { } /// Update a row in `todos`, identified by the primary key with [`UpdateTodos`] - pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_id: i32, item: &UpdateTodos) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::update(todos.filter(id.eq(param_id))).set(item).get_result(db) } /// Delete a row in `todos`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::todos::dsl::*; diesel::delete(todos.filter(id.eq(param_id))).execute(db) diff --git a/test/single_model_file/models/table1.rs b/test/single_model_file/models/table1.rs index 2e7ae446..2b82aa18 100644 --- a/test/single_model_file/models/table1.rs +++ b/test/single_model_file/models/table1.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -31,21 +30,21 @@ pub struct PaginationResult { impl Table1 { /// Insert a new row into `table1` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::table1::dsl::*; diesel::insert_into(table1).default_values().get_result::(db) } /// Get a row from `table1`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table1::dsl::*; table1.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::table1::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -63,7 +62,7 @@ impl Table1 { } /// Delete a row in `table1`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table1::dsl::*; diesel::delete(table1.filter(id.eq(param_id))).execute(db) diff --git a/test/single_model_file/models/table2.rs b/test/single_model_file/models/table2.rs index 63fbd0fa..116c884c 100644 --- a/test/single_model_file/models/table2.rs +++ b/test/single_model_file/models/table2.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -31,21 +30,21 @@ pub struct PaginationResult { impl Table2 { /// Insert a new row into `table2` with all default values - pub fn create(db: &mut ConnectionType) -> QueryResult { + pub fn create(db: &mut ConnectionType) -> diesel::QueryResult { use crate::schema::table2::dsl::*; diesel::insert_into(table2).default_values().get_result::(db) } /// Get a row from `table2`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table2::dsl::*; table2.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::table2::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -63,7 +62,7 @@ impl Table2 { } /// Delete a row in `table2`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: i32) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: i32) -> diesel::QueryResult { use crate::schema::table2::dsl::*; diesel::delete(table2.filter(id.eq(param_id))).execute(db) diff --git a/test/use_statements/models/fang_tasks/generated.rs b/test/use_statements/models/fang_tasks/generated.rs index ad3c06b6..0901871a 100644 --- a/test/use_statements/models/fang_tasks/generated.rs +++ b/test/use_statements/models/fang_tasks/generated.rs @@ -2,7 +2,6 @@ use crate::diesel::*; use crate::schema::*; -use diesel::QueryResult; pub type ConnectionType = diesel::r2d2::PooledConnection>; @@ -99,21 +98,21 @@ pub struct PaginationResult { impl FangTasks { /// Insert a new row into `fang_tasks` with a given [`CreateFangTasks`] - pub fn create(db: &mut ConnectionType, item: &CreateFangTasks) -> QueryResult { + pub fn create(db: &mut ConnectionType, item: &CreateFangTasks) -> diesel::QueryResult { use crate::schema::fang_tasks::dsl::*; diesel::insert_into(fang_tasks).values(item).get_result::(db) } /// Get a row from `fang_tasks`, identified by the primary key - pub fn read(db: &mut ConnectionType, param_id: uuid::Uuid) -> QueryResult { + pub fn read(db: &mut ConnectionType, param_id: uuid::Uuid) -> diesel::QueryResult { use crate::schema::fang_tasks::dsl::*; fang_tasks.filter(id.eq(param_id)).first::(db) } /// Paginates through the table where page is a 0-based index (i.e. page 0 is the first page) - pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> QueryResult> { + pub fn paginate(db: &mut ConnectionType, page: i64, page_size: i64) -> diesel::QueryResult> { use crate::schema::fang_tasks::dsl::*; let page_size = if page_size < 1 { 1 } else { page_size }; @@ -131,14 +130,14 @@ impl FangTasks { } /// Update a row in `fang_tasks`, identified by the primary key with [`UpdateFangTasks`] - pub fn update(db: &mut ConnectionType, param_id: uuid::Uuid, item: &UpdateFangTasks) -> QueryResult { + pub fn update(db: &mut ConnectionType, param_id: uuid::Uuid, item: &UpdateFangTasks) -> diesel::QueryResult { use crate::schema::fang_tasks::dsl::*; diesel::update(fang_tasks.filter(id.eq(param_id))).set(item).get_result(db) } /// Delete a row in `fang_tasks`, identified by the primary key - pub fn delete(db: &mut ConnectionType, param_id: uuid::Uuid) -> QueryResult { + pub fn delete(db: &mut ConnectionType, param_id: uuid::Uuid) -> diesel::QueryResult { use crate::schema::fang_tasks::dsl::*; diesel::delete(fang_tasks.filter(id.eq(param_id))).execute(db)