Skip to main content

CommentReaction

Struct CommentReaction 

Source
pub struct CommentReaction {
    pub id: i64,
    pub comment_id: i64,
    pub user_id: i64,
    pub reaction: String,
    pub created_at: Option<Timestamp>,
    /* private fields */
}
Expand description

A user’s reaction to a comment, from the comment_reactions table.

Fields§

§id: i64§comment_id: i64§user_id: i64§reaction: String§created_at: Option<Timestamp>

Implementations§

Source§

impl CommentReaction

Source

pub const id: Column<Self, i64>

The id column.

Source

pub const comment_id: Column<Self, i64>

The comment_id column.

Source

pub const user_id: Column<Self, i64>

The user_id column.

Source

pub const reaction: Column<Self, String>

The reaction column.

Source

pub const created_at: Column<Self, Option<Timestamp>>

The created_at column.

Source

pub fn query() -> Builder<Self>

Start a query on the model’s table.

Source

pub fn all() -> impl Future<Output = Result<Vec<Self>>> + Send

Load every row of the table.

Source

pub fn find( key: impl ComparableTo<i64>, ) -> impl Future<Output = Result<Option<Self>>> + Send

Find the row whose key is key, or return None when there’s no such row.

Source

pub fn find_or_fail( key: impl ComparableTo<i64>, ) -> impl Future<Output = Result<Self>> + Send

Find the row whose key is key, or fail with a ModelNotFound error.

A ModelNotFound error renders as a 404 response.

Source

pub fn find_many( keys: impl IntoIterator<Item: Borrow<i64> + IntoExpr>, ) -> impl Future<Output = Result<Vec<Self>>> + Send

Find the rows whose keys are in keys.

Source

pub fn first_where( condition: impl IntoCondition, ) -> impl Future<Output = Result<Option<Self>>> + Send

Find the first row that meets condition, or return None when no row does.

Source

pub fn create() -> CommentReactionCreate

Start creating a row.

Set the row’s columns on the returned builder, then await the builder to insert the row and return the model as the database stored it.

Source

pub fn destroy( keys: impl IntoIterator<Item: Borrow<i64> + IntoExpr>, ) -> impl Future<Output = Result<u64>> + Send

Find the models whose keys are in keys, then delete each one as delete does.

Each deletion runs the model’s deleting hook and dispatches its Deleted event. Returns how many rows were deleted.

Source

pub fn first_or_create( condition: impl IntoCondition, values: impl IntoCreate<Self>, ) -> FindOrCreate<Self>

Find the first row that meets condition, or create a new row when no row does.

The new row takes its columns from the column = value comparisons that condition joins with &, and values replaces those columns. eq(None) and is_null() give the column NULL.

If another request inserts the row after the lookup, the insert violates a unique index, and this method returns the other request’s row. Without a unique index, both requests insert a row. Inside a transaction, the insert runs in a savepoint, so the violation doesn’t end the transaction. found_or_created() reports whether this call inserted the row.

Source

pub fn update_or_create( condition: impl IntoCondition, values: impl IntoCreate<Self>, ) -> FindOrCreate<Self>

Update the first row that meets condition with the columns of values, or create a new row when no row does.

The new row takes its columns from the column = value comparisons that condition joins with &, and values replaces those columns. If the insert violates a unique index, this method updates the first row that meets condition instead. When the create also creates related models, it returns the database error rather than update the row. found_or_created() reports whether this call inserted the row.

Source

pub fn insert<V: IntoRow<Self>>( rows: impl IntoIterator<Item = V>, ) -> impl Future<Output = Result<u64>> + Send

Insert rows and return how many rows were inserted.

The rows are written with one statement per run of consecutive rows that set the same columns, all in one transaction. Each row is a row! or a Fill struct, and gets both timestamps. The insert runs no hooks, dispatches no events, and doesn’t read the rows back. Inserting no rows runs no query.

Source

pub fn upsert<V: IntoRow<Self>>( rows: impl IntoIterator<Item = V>, unique_by: impl Columns<Self>, updates: impl Columns<Self>, ) -> impl Future<Output = Result<u64>> + Send

Insert rows as insert does, with one statement per run of consecutive rows that set the same columns, all in one transaction, and update the rows that conflict on the unique_by columns instead.

A conflicting row gets the updates columns and a new updated_at. Returns the number of affected rows. MySQL counts an updated row twice.

Source

pub fn update(&mut self) -> CommentReactionUpdate<'_>

Start updating the model.

Set the columns on the returned builder, then await the builder to write the columns that changed. If the updating hook or the write fails, the model keeps its previous values. After the write succeeds, it holds the new values even if an Updated listener fails.

Source

pub fn increment<T>( &mut self, column: Column<Self, T>, amount: T, ) -> CommentReactionUpdate<'_>
where T: Add<Output = T> + IntoExpr + Clone + Send + Sync + 'static,

Start an update that adds amount to column, as column = column + amount, in both the database and this model.

Source

pub fn decrement<T>( &mut self, column: Column<Self, T>, amount: T, ) -> CommentReactionUpdate<'_>
where T: Sub<Output = T> + IntoExpr + Clone + Send + Sync + 'static,

Start an update that subtracts amount from column, as column = column - amount, in both the database and this model.

Source

pub fn delete(self) -> impl Future<Output = Result<()>> + Send

Delete the model’s row.

Source

pub fn delete_quietly(self) -> impl Future<Output = Result<()>> + Send

Delete the model’s row without dispatching Deleted.

Source

pub fn fresh(&self) -> impl Future<Output = Result<Option<Self>>> + Send + use<>

Load the model’s row as the database has it now, or return None when the row is gone.

Source

pub fn refresh(&mut self) -> impl Future<Output = Result<()>> + Send + '_

Reload the model and its loaded relations from the database.

If the row is gone, this fails with ModelNotFound and leaves the model as it was.

Source

pub fn update_values( &mut self, values: Values, ) -> impl Future<Output = Result<()>> + Send + '_

Update the model’s row with values, as a query’s update_values does, then reload the model as refresh does.

The update runs no hooks and dispatches no events.

Source

pub fn is(&self, other: &Self) -> bool

Whether other is the same row, with the same key and read from the same connection.

A model that a cache or a request deserialized counts as read from the default connection. PartialEq, when the model derives it, compares every column instead.

Source

pub fn is_not(&self, other: &Self) -> bool

Whether other is a different row, the same as !self.is(other).

Source

pub fn without_relations(&self) -> Self

Copy the model’s columns, without any loaded or counted relationships.

Source

pub fn replicate(&self) -> Replica<'_, Self>

The model’s columns for a new row, without its key and timestamps.

Use it to copy a row, as in create!(Post { title: "Copy", ..post.replicate() }).

Source

pub fn load( &mut self, relations: impl IntoEager<Self>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Load relations into this model. Pass one relation or a tuple of relations.

Source

pub fn load_missing( &mut self, relations: impl IntoEager<Self>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Load relations into this model when it doesn’t hold them yet, as ModelList::load_missing does.

Source

pub fn load_count( &mut self, relations: impl IntoCount<Self>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Count the related rows of relations for this model, as with_count does.

Source

pub fn load_exists( &mut self, relations: impl IntoCount<Self>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>

Check whether this model has related rows of relations, as with_exists does.

Source

pub fn load_sum<__LaravelRelation, __LaravelTable, __LaravelValue>( &mut self, relation: __LaravelRelation, column: Column<__LaravelTable, __LaravelValue>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
where __LaravelRelation: IntoAggregate<Self>, __LaravelTable: QueryTable<__LaravelRelation::Related>, __LaravelValue: Numeric,

Add up column over this model’s related rows, as with_sum does.

Source

pub fn load_max<__LaravelRelation, __LaravelTable, __LaravelValue>( &mut self, relation: __LaravelRelation, column: Column<__LaravelTable, __LaravelValue>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
where __LaravelRelation: IntoAggregate<Self>, __LaravelTable: QueryTable<__LaravelRelation::Related>, __LaravelValue: Ordered,

Find the largest value of column among this model’s related rows, as with_max does.

Source

pub fn load_min<__LaravelRelation, __LaravelTable, __LaravelValue>( &mut self, relation: __LaravelRelation, column: Column<__LaravelTable, __LaravelValue>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
where __LaravelRelation: IntoAggregate<Self>, __LaravelTable: QueryTable<__LaravelRelation::Related>, __LaravelValue: Ordered,

Find the smallest value of column among this model’s related rows, as with_min does.

Source

pub fn load_avg<__LaravelRelation, __LaravelTable, __LaravelValue>( &mut self, relation: __LaravelRelation, column: Column<__LaravelTable, __LaravelValue>, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + '_>>
where __LaravelRelation: IntoAggregate<Self>, __LaravelTable: QueryTable<__LaravelRelation::Related>, __LaravelValue: Numeric,

Average column over this model’s related rows, as with_avg does.

Trait Implementations§

Source§

impl Clone for CommentReaction

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CommentReaction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<S: Send + Sync> FromRequestParts<S> for CommentReaction

Source§

type Rejection = Error

If the extractor fails it’ll use this “rejection” type. A rejection is a kind of error that can be converted into a response.
Source§

fn from_request_parts( __laravel_parts: &mut Parts, _: &S, ) -> impl Future<Output = Result<Self>> + Send

Perform the extraction.
Source§

impl FromRow for CommentReaction

Source§

fn from_row(__laravel_row: &AnyRow) -> Result<Self>

Build the value from row. Read more
Source§

impl Hooks for CommentReaction

Source§

fn creating( _draft: &mut Draft<Self>, ) -> impl Future<Output = Result<(), Error>> + Send

Runs before a create inserts a row, with the columns the create is about to insert. Read more
Source§

fn updating( &mut self, _changes: &Changes<Self>, ) -> impl Future<Output = Result<(), Error>> + Send

Runs before an update writes, with the changed model and the columns that changed. Read more
Source§

fn deleting(&self) -> impl Future<Output = Result<(), Error>> + Send

Runs before delete or destroy deletes the model’s row. Read more
Source§

impl<__LaravelValues> IntoKeys<CommentReaction, __LaravelValues> for CommentReaction

Source§

impl<__LaravelValues> IntoKeys<CommentReaction, __LaravelValues> for &CommentReaction

Source§

impl<__LaravelValues> IntoKeys<CommentReaction, __LaravelValues> for i64

Source§

impl<__LaravelValues> IntoKeys<CommentReaction, __LaravelValues> for &i64

Source§

impl Model for CommentReaction

Source§

const META: Meta<Self>

The model’s table, key, and columns.
Source§

type Key = i64

The type of the model’s key.
Source§

type Create = CommentReactionCreate

The builder that create returns, such as PostCreate, which has a setter for each column.
Source§

type MassUpdate = CommentReactionMassUpdate

The builder that a model query’s update returns, such as PostMassUpdate, which has a setter for each column.
Source§

impl RouteModel for CommentReaction

Source§

const PARAMETER: &'static str = CommentReaction

The route parameter that Bound finds the record by, such as "post" for /posts/{post}.
Source§

type Key = i64

The type of the parameter’s value, such as i64 or String.
Source§

fn find(__laravel_key: i64) -> impl Future<Output = Result<Option<Self>>> + Send

The record with this key, or None when no record has it. Read more
Source§

impl RouteParam for CommentReaction

Source§

fn to_route_param(&self) -> String

The value as it appears in the URL, before encoding.
Source§

impl Serialize for CommentReaction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Forget for CommentReaction

§

impl Freeze for CommentReaction
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze, *const ArcInner<str> is !null: Freeze, PhantomData<ArcInner<str>>: Freeze,

§

impl Move for CommentReaction

§

impl RefUnwindSafe for CommentReaction

§

impl Send for CommentReaction
where RawVecInner: Send, Arc<str>: Send,

§

impl Sync for CommentReaction
where RawVecInner: Sync, Arc<str>: Sync,

§

impl Unpin for CommentReaction
where *const u8 is !null: Unpin, Arc<str>: Unpin,

§

impl UnsafeUnpin for CommentReaction
where *const u8 is !null: UnsafeUnpin, PhantomData<u8>: UnsafeUnpin, *const ArcInner<str> is !null: UnsafeUnpin, PhantomData<ArcInner<str>>: UnsafeUnpin,

§

impl UnwindSafe for CommentReaction
where RawVecInner: UnwindSafe, Arc<str>: UnwindSafe,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> Fake for T

Source§

fn fake<U>(&self) -> U
where Self: FakeBase<U>,

Source§

fn fake_with_rng<U, R>(&self, rng: &mut R) -> U
where R: RngExt + ?Sized, Self: FakeBase<U>,

Source§

impl<T> FillValue<Option<T>> for T
where T: Send + 'static,

Source§

async fn fill(self) -> Result<Option<T>, Error>

Resolves the column’s value. Read more
Source§

impl<T> FillValue<T> for T
where T: Send + 'static,

Source§

async fn fill(self) -> Result<T, Error>

Resolves the column’s value. Read more
Source§

impl<N> ForParent<N> for N
where N: Model,

Source§

fn __for_parent(self) -> Shared<N>

Source§

impl<K> ForeignKey<K> for K

Source§

fn key(&self) -> Option<&K>

Returns the key, or None when the field holds no key.
Source§

fn __from_key(key: K) -> K

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<S, T> FromRequest<S, ViaParts> for T
where S: Send + Sync, T: FromRequestParts<S>,

Source§

type Rejection = <T as FromRequestParts<S>>::Rejection

If the extractor fails it’ll use this “rejection” type. A rejection is a kind of error that can be converted into a response.
Source§

fn from_request( req: Request<Body>, state: &S, ) -> impl Future<Output = Result<T, <T as FromRequest<S, ViaParts>>::Rejection>>

Perform the extraction.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<N> IntoModels<N> for N
where N: Model,

Source§

fn __models(self) -> Vec<N>

Source§

impl<N> IntoParent<N> for N
where N: Model,

Source§

fn __parent(self) -> Parent<N>

Source§

impl<T> IntoViewData for T
where T: Serialize,

Source§

fn into_view_data(self) -> ViewData

Converts the value into view data.
Source§

impl<T, N> NotifiedBy<T> for N
where T: Notification<N>,

Source§

fn __routes(&self) -> Vec<Route>

Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> RouteParams for T
where T: RouteParam,

Source§

fn into_params<'a>(self) -> Params<'a>
where T: 'a,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T, V> UpdateValue<T> for V
where V: FillValue<T>,

Source§

fn __update<M, U>(self, column: Column<M, T>, update: U) -> U
where M: Model, U: Updates<M>, T: IntoExpr + Clone + Send + Sync + 'static,

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<M> __Models for M
where M: Model,

Source§

const REQUIRED: bool = true

Whether restoring the field fails when a model’s row no longer exists. A Vec leaves the missing model out instead.
Source§

const OPTIONAL: bool = false

Whether a payload without the field restores it as None.
Source§

type Model = M

The type of model the field holds.
Source§

type Keys = <M as Model>::Key

The keys of the field’s models, in the form the queue stores them.
Source§

fn models(&self) -> impl Iterator<Item = &M>

Returns the models the field holds.
Source§

fn store( &self, key: impl FnMut(&M) -> Result<Value, Error>, ) -> Result<Value, Error>

Returns the field’s stored form, built from the stored form of each model’s key. Read more
Source§

fn keys(key: &<M as Model>::Key) -> Vec<<M as Model>::Key>

Returns the keys whose rows the queue reads to restore the field.
Source§

fn restore(key: <M as Model>::Key, rows: &HashMap<<M as Model>::Key, M>) -> M

Rebuilds the field from its stored keys and the rows the queue found for them.