Skip to main content

TypedTableMutator

Struct TypedTableMutator 

Source
pub struct TypedTableMutator<'tx, R> { /* private fields */ }
Expand description

The typed CRUD operations of a table in a mutator (tx.mutate.<table> in JS), which the generated mutate module returns:

ⓘ
mutate::issue(tx).insert(&issue)?;
mutate::issue(tx).update(&IssueUpdate { closed: Some(true), ..IssueUpdate::new(id) })?;

Implementations§

Source§

impl<'tx, R: ZeroRow> TypedTableMutator<'tx, R>

Source

pub fn new(tx: &'tx Transaction) -> Self

For generated code.

Source

pub fn insert(&self, row: &R) -> Result<(), Error>

Inserts a row unless one with its primary key exists.

Source

pub fn upsert(&self, row: &R) -> Result<(), Error>

Inserts a row, or replaces the columns of the existing one. Every column is written, so an optional one that is None sets null; JS keeps a column the value leaves out. Use update to set only some columns.

Source

pub fn update(&self, value: &R::Update) -> Result<(), Error>

Sets the columns that value sets, of the row with its primary key, if the row exists.

Source

pub fn delete(&self, key: &R::Key) -> Result<(), Error>

Deletes the row with the primary key key, if any.

Auto Trait Implementations§

§

impl<'tx, R> !RefUnwindSafe for TypedTableMutator<'tx, R>

§

impl<'tx, R> !Send for TypedTableMutator<'tx, R>

§

impl<'tx, R> !Sync for TypedTableMutator<'tx, R>

§

impl<'tx, R> !UnwindSafe for TypedTableMutator<'tx, R>

§

impl<'tx, R> Forget for TypedTableMutator<'tx, R>

§

impl<'tx, R> Freeze for TypedTableMutator<'tx, R>
where PhantomData<fn() -> R>: Freeze,

§

impl<'tx, R> Move for TypedTableMutator<'tx, R>

§

impl<'tx, R> Unpin for TypedTableMutator<'tx, R>
where PhantomData<fn() -> R>: Unpin,

§

impl<'tx, R> UnsafeUnpin for TypedTableMutator<'tx, R>
where PhantomData<fn() -> R>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.