pub struct PrimaryKey {
pub table: Cow<'static, str>,
pub name: Cow<'static, str>,
pub columns: Cow<'static, [Cow<'static, str>]>,
pub name_explicit: bool,
}Available on crate feature
std only.Expand description
Runtime primary key constraint entity
Uses Cow<'static, str> for all string fields, which works with both:
- Borrowed data from const definitions (
Cow::Borrowed) - Owned data from deserialization/introspection (
Cow::Owned)
Fields§
§table: Cow<'static, str>Parent table name
name: Cow<'static, str>Constraint name
columns: Cow<'static, [Cow<'static, str>]>Columns in the primary key
name_explicit: boolWhether the constraint name was explicitly specified
Implementations§
Source§impl PrimaryKey
impl PrimaryKey
Sourcepub fn new(
table: impl Into<Cow<'static, str>>,
name: impl Into<Cow<'static, str>>,
columns: impl Into<Cow<'static, [Cow<'static, str>]>>,
) -> PrimaryKey
Available on crate features alloc or std only.
pub fn new( table: impl Into<Cow<'static, str>>, name: impl Into<Cow<'static, str>>, columns: impl Into<Cow<'static, [Cow<'static, str>]>>, ) -> PrimaryKey
alloc or std only.Create a new primary key with owned data
Sourcepub fn from_strings(
table: String,
name: String,
columns: Vec<String>,
) -> PrimaryKey
Available on crate features alloc or std only.
pub fn from_strings( table: String, name: String, columns: Vec<String>, ) -> PrimaryKey
alloc or std only.Create a new primary key from owned strings (convenience for runtime construction)
Source§impl PrimaryKey
impl PrimaryKey
Sourcepub fn to_constraint_sql(&self) -> String
Available on crate features alloc or std only.
pub fn to_constraint_sql(&self) -> String
alloc or std only.Generate the PRIMARY KEY constraint clause
Trait Implementations§
Source§impl Clone for PrimaryKey
impl Clone for PrimaryKey
Source§fn clone(&self) -> PrimaryKey
fn clone(&self) -> PrimaryKey
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrimaryKey
impl Debug for PrimaryKey
Source§impl Default for PrimaryKey
impl Default for PrimaryKey
Source§fn default() -> PrimaryKey
fn default() -> PrimaryKey
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PrimaryKey
impl<'de> Deserialize<'de> for PrimaryKey
Source§fn deserialize<D>(
deserializer: D,
) -> Result<PrimaryKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<PrimaryKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for PrimaryKey
Source§impl From<PrimaryKeyDef> for PrimaryKey
impl From<PrimaryKeyDef> for PrimaryKey
Source§fn from(def: PrimaryKeyDef) -> PrimaryKey
fn from(def: PrimaryKeyDef) -> PrimaryKey
Converts to this type from the input type.
Source§impl PartialEq for PrimaryKey
impl PartialEq for PrimaryKey
Source§impl Serialize for PrimaryKey
impl Serialize for PrimaryKey
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for PrimaryKey
Auto Trait Implementations§
impl Freeze for PrimaryKey
impl RefUnwindSafe for PrimaryKey
impl Send for PrimaryKey
impl Sync for PrimaryKey
impl Unpin for PrimaryKey
impl UnsafeUnpin for PrimaryKey
impl UnwindSafe for PrimaryKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more