Struct Remove

Source
pub struct Remove<'a> { /* private fields */ }
Expand description

Instruction for removing papers from the database.

This struct implements the DatabaseInstruction trait to provide paper removal functionality. It handles:

  • Paper identification through queries
  • Related data cleanup (authors, files)
  • Transaction management
  • Dry run simulation

Implementations§

Source§

impl<'a> Remove<'a>

Source

pub fn from_query(query: Query<'a>) -> Self

Creates a remove instruction from an existing query.

This method allows any query to be converted into a remove operation, providing maximum flexibility in identifying papers to remove.

§Arguments
  • query - The query that identifies papers to remove
§Examples
// Remove papers matching a text search
let query = Query::text("quantum computing");
let remove = Remove::from_query(query);

// Remove papers before a date
use chrono::{DateTime, Utc};
let date = DateTime::parse_from_rfc3339("2020-01-01T00:00:00Z").unwrap().with_timezone(&Utc);
let query = Query::before_date(date);
let remove = Remove::from_query(query);
Source

pub fn by_source(source: &'a str, identifier: &'a str) -> Self

Creates a remove instruction for a specific paper by its source and identifier.

This is a convenience method for the common case of removing a single paper identified by its source system and ID.

§Arguments
  • source - The paper’s source system (arXiv, DOI, etc.)
  • identifier - The source-specific identifier
§Examples
// Remove an arXiv paper
let remove = Remove::by_source("arxiv", "2301.07041");

// Remove a DOI paper
let remove = Remove::by_source("doi", "10.1145/1327452.1327492");
Source

pub fn by_author(name: &'a str) -> Self

Creates a remove instruction for all papers by a specific author.

This method provides a way to remove all papers associated with a particular author name. It performs partial matching on the name.

§Arguments
  • name - The author name to match
§Examples
// Remove all papers by an author
let remove = Remove::by_author("Alice Researcher");
Source

pub fn dry_run(self) -> Self

Enables dry run mode for the remove operation.

In dry run mode, the operation will:

  • Query papers that would be removed
  • Return the list of papers
  • Not modify the database

This is useful for:

  • Previewing removal operations
  • Validating queries
  • Testing removal logic
§Examples
// Preview papers that would be removed
let papers = Remove::by_author("Alice Researcher").dry_run().execute(&mut db).await?;

println!("Would remove {} papers", papers.len());

Trait Implementations§

Source§

impl DatabaseInstruction for Remove<'_>

Source§

type Output = Vec<Paper>

The type returned by executing this instruction.
Source§

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, db: &'life1 mut Database, ) -> Pin<Box<dyn Future<Output = Result<Self::Output>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Executes the instruction against a database connection. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Remove<'a>

§

impl<'a> RefUnwindSafe for Remove<'a>

§

impl<'a> Send for Remove<'a>

§

impl<'a> Sync for Remove<'a>

§

impl<'a> Unpin for Remove<'a>

§

impl<'a> UnwindSafe for Remove<'a>

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> 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<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> 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<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T