drizzle-types 0.4.0

A type-safe SQL query builder for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//! Naming rules every dialect's schema producers share.

/// The columns that name a table-level (composite) foreign key: its first
/// column, or all of them when another foreign key on the same table would
/// otherwise get the same name.
#[must_use]
pub fn composite_foreign_key_name_columns<'a>(
    columns: &'a [&'a str],
    collides: bool,
) -> &'a [&'a str] {
    if collides || columns.is_empty() {
        columns
    } else {
        &columns[..1]
    }
}