Skip to main content

CoreRepository

Struct CoreRepository 

Source
pub struct CoreRepository;
Expand description

Repository for installed package operations.

Implementations§

Source§

impl CoreRepository

Source

pub fn list_all(conn: &mut SqliteConnection) -> QueryResult<Vec<Package>>

Lists all installed packages.

Source

pub fn list_filtered( conn: &mut SqliteConnection, repo_name: Option<&str>, pkg_name: Option<&str>, pkg_id: Option<&str>, version: Option<&str>, is_installed: Option<bool>, pinned: Option<bool>, limit: Option<i64>, sort_by_id: Option<SortDirection>, ) -> QueryResult<Vec<InstalledPackageWithPortable>>

Lists installed packages with flexible filtering.

Source

pub fn list_broken( conn: &mut SqliteConnection, ) -> QueryResult<Vec<InstalledPackageWithPortable>>

Lists broken packages (is_installed = false).

Source

pub fn list_updatable( conn: &mut SqliteConnection, ) -> QueryResult<Vec<InstalledPackageWithPortable>>

Lists installed packages that are not pinned (for updates).

Source

pub fn find_exact( conn: &mut SqliteConnection, repo_name: &str, pkg_name: &str, pkg_id: &str, version: &str, ) -> QueryResult<Option<InstalledPackageWithPortable>>

Finds an installed package by exact match on repo_name, pkg_name, pkg_id, and version.

Source

pub fn list_all_with_portable( conn: &mut SqliteConnection, ) -> QueryResult<Vec<InstalledPackageWithPortable>>

Lists all installed packages with portable configuration.

Source

pub fn list_by_repo( conn: &mut SqliteConnection, repo_name: &str, ) -> QueryResult<Vec<Package>>

Lists installed packages filtered by repo_name.

Source

pub fn list_by_repo_with_portable( conn: &mut SqliteConnection, repo_name: &str, ) -> QueryResult<Vec<InstalledPackageWithPortable>>

Lists installed packages filtered by repo_name with portable configuration.

Source

pub fn count(conn: &mut SqliteConnection) -> QueryResult<i64>

Counts installed packages.

Source

pub fn count_distinct_installed( conn: &mut SqliteConnection, repo_name: Option<&str>, ) -> QueryResult<i64>

Counts distinct installed packages.

Source

pub fn find_by_id( conn: &mut SqliteConnection, id: i32, ) -> QueryResult<Option<Package>>

Finds an installed package by ID.

Source

pub fn find_by_id_with_portable( conn: &mut SqliteConnection, id: i32, ) -> QueryResult<Option<InstalledPackageWithPortable>>

Finds an installed package by ID with portable configuration.

Source

pub fn find_by_name( conn: &mut SqliteConnection, name: &str, ) -> QueryResult<Vec<Package>>

Finds installed packages by name.

Source

pub fn find_by_name_with_portable( conn: &mut SqliteConnection, name: &str, ) -> QueryResult<Vec<InstalledPackageWithPortable>>

Finds installed packages by name with portable configuration.

Source

pub fn find_alternates( conn: &mut SqliteConnection, pkg_name: &str, exclude_pkg_id: &str, exclude_version: &str, ) -> QueryResult<Vec<InstalledPackageWithPortable>>

Finds installed packages by name, excluding specific pkg_id and version.

Source

pub fn find_by_pkg_id_and_repo( conn: &mut SqliteConnection, pkg_id: &str, repo_name: &str, ) -> QueryResult<Option<Package>>

Finds an installed package by pkg_id and repo_name.

Source

pub fn find_by_pkg_id_name_and_repo( conn: &mut SqliteConnection, pkg_id: &str, pkg_name: &str, repo_name: &str, ) -> QueryResult<Option<Package>>

Finds an installed package by pkg_id, pkg_name, and repo_name.

Source

pub fn insert( conn: &mut SqliteConnection, package: &NewPackage<'_>, ) -> QueryResult<i32>

Inserts a new installed package and returns the inserted ID.

Source

pub fn update_version( conn: &mut SqliteConnection, id: i32, new_version: &str, ) -> QueryResult<usize>

Updates an installed package’s version.

Source

pub fn record_installation( conn: &mut SqliteConnection, repo_name: &str, pkg_name: &str, pkg_id: &str, version: &str, size: i64, provides: Option<Vec<PackageProvide>>, checksum: Option<&str>, installed_date: &str, installed_path: &str, ) -> QueryResult<Option<i32>>

Updates an installed package after successful installation. Only updates the record with is_installed=false (the newly created one).

Source

pub fn set_pinned( conn: &mut SqliteConnection, id: i32, pinned: bool, ) -> QueryResult<usize>

Sets the pinned status of a package.

Source

pub fn set_unlinked( conn: &mut SqliteConnection, id: i32, unlinked: bool, ) -> QueryResult<usize>

Sets the unlinked status of a package.

Unlinks all packages with a given name except those matching pkg_id and version.

Source

pub fn update_pkg_id( conn: &mut SqliteConnection, repo_name: &str, old_pkg_id: &str, new_pkg_id: &str, ) -> QueryResult<usize>

Updates the pkg_id for packages matching repo_name and old pkg_id.

Source

pub fn delete(conn: &mut SqliteConnection, id: i32) -> QueryResult<usize>

Deletes an installed package by ID.

Source

pub fn has_pending_install( conn: &mut SqliteConnection, pkg_id: &str, pkg_name: &str, repo_name: &str, version: &str, ) -> QueryResult<bool>

Checks if a pending install (is_installed=false) exists for a specific package version. Used to check if we can resume a partial install.

Source

pub fn delete_pending_installs( conn: &mut SqliteConnection, pkg_id: &str, pkg_name: &str, repo_name: &str, ) -> QueryResult<Vec<String>>

Deletes pending (is_installed=false) records for a package and returns their paths. Used to clean up orphaned partial installs before starting a new install.

Source

pub fn get_portable( conn: &mut SqliteConnection, package_id: i32, ) -> QueryResult<Option<PortablePackage>>

Gets the portable package configuration for a package.

Source

pub fn insert_portable( conn: &mut SqliteConnection, portable: &NewPortablePackage<'_>, ) -> QueryResult<usize>

Inserts portable package configuration.

Source

pub fn upsert_portable( conn: &mut SqliteConnection, package_id: i32, portable_path: Option<&str>, portable_home: Option<&str>, portable_config: Option<&str>, portable_share: Option<&str>, portable_cache: Option<&str>, ) -> QueryResult<usize>

Updates or inserts portable package configuration.

Source

pub fn delete_portable( conn: &mut SqliteConnection, package_id: i32, ) -> QueryResult<usize>

Deletes portable package configuration.

Source

pub fn get_old_package_paths( conn: &mut SqliteConnection, pkg_id: &str, pkg_name: &str, repo_name: &str, force: bool, ) -> QueryResult<Vec<(i32, String)>>

Gets old package versions (all except the newest one) for cleanup. Returns the installed paths of packages to remove. If force is true, includes pinned packages. Otherwise only unpinned packages.

Source

pub fn delete_old_packages( conn: &mut SqliteConnection, pkg_id: &str, pkg_name: &str, repo_name: &str, force: bool, ) -> QueryResult<usize>

Deletes old package versions (all except the newest one). If force is true, deletes pinned packages too. Otherwise only unpinned packages.

Unlinks all packages with a given name except those matching pkg_id and checksum. Used when switching between alternate package versions.

Links a package by pkg_name, pkg_id, and checksum. Used when switching to an alternate package version.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AggregateExpressionMethods for T

Source§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
Source§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
Source§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
Source§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
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> WindowExpressionMethods for T

Source§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
Source§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
Source§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
Source§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
Source§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
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