mirror of
https://github.com/diesel-rs/diesel.git
synced 2024-10-04 01:28:13 +03:00
weiznich review feedback: Add documentation of attribute to Insertable field attributes. Add changelog entry. Remove default intialization of struct fields in example test.
This commit is contained in:
parent
b499541349
commit
d2054c2aa8
@ -15,6 +15,7 @@ Increasing the minimal supported Rust version will always be coupled at least wi
|
||||
* Added automatic usage of all sqlite `rowid` aliases when no explicit primary key is defined for `print-schema`
|
||||
* Added a `#[dsl::auto_type]` attribute macro, allowing to infer type of query fragment functions
|
||||
* Added the same type inference on `Selectable` derives, which allows skipping specifying `select_expression_type` most of the time, in turn enabling most queries to be written using just a `Selectable` derive.
|
||||
* Added an optional `#[diesel(skip_insertion)]` field attribute to the `Insertable` derive macro, allowing fields which map to generated columns to be skipped during insertion.
|
||||
|
||||
### Changed
|
||||
|
||||
|
@ -334,6 +334,8 @@ pub fn derive_identifiable(input: TokenStream) -> TokenStream {
|
||||
/// the actual field type.
|
||||
/// * `#[diesel(treat_none_as_default_value = true/false)]`, overrides the container-level
|
||||
/// `treat_none_as_default_value` attribute for the current field.
|
||||
/// * `#[diesel(skip_insertion)]`, skips insertion of this field. Useful for working with
|
||||
/// generated columns.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
|
@ -469,7 +469,7 @@ fn insert_with_generated_column() {
|
||||
"CREATE TABLE user_with_last_names (
|
||||
first_name VARCHAR NOT NULL PRIMARY KEY,
|
||||
last_name VARCHAR NOT NULL,
|
||||
full_NAME VARCHAR GENERATED ALWAYS AS (first_name || ' ' || last_name) STORED
|
||||
full_name VARCHAR GENERATED ALWAYS AS (first_name || ' ' || last_name) STORED
|
||||
)",
|
||||
)
|
||||
.execute(connection)
|
||||
@ -477,7 +477,7 @@ fn insert_with_generated_column() {
|
||||
let new_users: &[_] = &[UserWithLastName {
|
||||
first_name: "Sean".to_string(),
|
||||
last_name: "Black".to_string(),
|
||||
..Default::default()
|
||||
full_name: "This field not inserted".to_string(),
|
||||
}];
|
||||
let count = insert_into(users)
|
||||
.values(new_users)
|
||||
|
Loading…
Reference in New Issue
Block a user