pub struct Pgnc<T>(pub T);Tuple Fields§
§0: TImplementations§
Source§impl Pgnc<&mut Scalar>
First generate names, because only check constraint are mergeable, and there is no problem with merging unrelated
constraints, then merge constraints with the same name.
impl Pgnc<&mut Scalar>
First generate names, because only check constraint are mergeable, and there is no problem with merging unrelated constraints, then merge constraints with the same name.
Sourcepub fn generate_name(&self, rn: &mut RenameMap)
pub fn generate_name(&self, rn: &mut RenameMap)
Generate name for the scalar itself
Sourcepub fn generate_names(&mut self, rn: &mut RenameMap)
pub fn generate_names(&mut self, rn: &mut RenameMap)
In postgres, first check constraint has autogenerated table_check name, second is table_check1 and so on.
In immigrant, constraints with the same name are merged, so only name we should save to every constraint is
table_check
Sourcepub fn merge_checks(&mut self, rn: &RenameMap)
pub fn merge_checks(&mut self, rn: &RenameMap)
All checks with the same name are merged using AND
Source§impl Pgnc<&mut Table>
First merge constraints, to allow specifying partial primary keys, i.e
impl Pgnc<&mut Table>
First merge constraints, to allow specifying partial primary keys, i.e
a @primary_key;
b @primary_key;
c @primary_key;Should be equivalent to
a;
b;
c;
@primary_key(a, b, c)Then generate names, i.e for the specified example it will be table_a_b_c_pk
Sourcepub fn generate_name(&self, rn: &mut RenameMap)
pub fn generate_name(&self, rn: &mut RenameMap)
Generate name for the table itself
pub fn generate_column_names(&self, rn: &mut RenameMap)
Sourcepub fn merge(&mut self, rn: &RenameMap)
pub fn merge(&mut self, rn: &RenameMap)
Merge annotations:
- Primary keys are always merged, it is assumed at most only name will be set. TODO: It gets weird in presence of mixins, e.g mixin can add another primary key, how that should be handled?
- Checks with the same name (+all unnamed) are merged using AND
- Unique constraints are merged the same way as the primary key, but unnamed uniques are not merged
- Indexes are merged the same way as unique constraints, except accounting for the uniqueness flag
pub fn generate_names(&mut self, rn: &mut RenameMap)
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Pgnc<T>where
T: Freeze,
impl<T> RefUnwindSafe for Pgnc<T>where
T: RefUnwindSafe,
impl<T> Send for Pgnc<T>where
T: Send,
impl<T> Sync for Pgnc<T>where
T: Sync,
impl<T> Unpin for Pgnc<T>where
T: Unpin,
impl<T> UnwindSafe for Pgnc<T>where
T: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Return a random value via the
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
👎Deprecated since 0.9.0: Renamed to
random to avoid conflict with the new gen keyword in Rust 2024.Alias for
Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
👎Deprecated since 0.9.0: Renamed to
random_rangeAlias for
Rng::random_range.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of a RNG error.
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
Return the next random
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
Return the next random
u64.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
Fill
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
Wrap RNG with the
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
Convert an
RngCore to a RngReadAdapter.