pub struct Plugin {Show 18 fields
pub id: Uuid,
pub name: String,
pub description: String,
pub current_version: String,
pub category: String,
pub license: String,
pub repository: Option<String>,
pub homepage: Option<String>,
pub downloads_total: i64,
pub rating_avg: Decimal,
pub rating_count: i32,
pub author_id: Uuid,
pub verified_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub language: String,
pub taken_down_at: Option<DateTime<Utc>>,
pub taken_down_reason: Option<String>,
}Fields§
§id: Uuid§name: String§description: String§current_version: String§category: String§license: String§repository: Option<String>§homepage: Option<String>§downloads_total: i64§rating_avg: Decimal§rating_count: i32§verified_at: Option<DateTime<Utc>>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>§language: String§taken_down_at: Option<DateTime<Utc>>§taken_down_reason: Option<String>Implementations§
Source§impl Plugin
impl Plugin
Sourcepub async fn search(
pool: &Pool<Postgres>,
query: Option<&str>,
category: Option<&str>,
language: Option<&str>,
tags: &[String],
sort_by: &str,
limit: i64,
offset: i64,
) -> Result<Vec<Plugin>, Error>
pub async fn search( pool: &Pool<Postgres>, query: Option<&str>, category: Option<&str>, language: Option<&str>, tags: &[String], sort_by: &str, limit: i64, offset: i64, ) -> Result<Vec<Plugin>, Error>
Search plugins
Sourcepub async fn count_search(
pool: &Pool<Postgres>,
query: Option<&str>,
category: Option<&str>,
language: Option<&str>,
tags: &[String],
) -> Result<i64, Error>
pub async fn count_search( pool: &Pool<Postgres>, query: Option<&str>, category: Option<&str>, language: Option<&str>, tags: &[String], ) -> Result<i64, Error>
Count total matching plugins for a search (used for pagination)
Sourcepub async fn find_by_name(
pool: &Pool<Postgres>,
name: &str,
) -> Result<Option<Plugin>, Error>
pub async fn find_by_name( pool: &Pool<Postgres>, name: &str, ) -> Result<Option<Plugin>, Error>
Find plugin by name
Get plugin tags
Sourcepub async fn create(
pool: &Pool<Postgres>,
name: &str,
description: &str,
version: &str,
category: &str,
license: &str,
repository: Option<&str>,
homepage: Option<&str>,
author_id: Uuid,
language: &str,
) -> Result<Plugin, Error>
pub async fn create( pool: &Pool<Postgres>, name: &str, description: &str, version: &str, category: &str, license: &str, repository: Option<&str>, homepage: Option<&str>, author_id: Uuid, language: &str, ) -> Result<Plugin, Error>
Create new plugin
Sourcepub async fn increment_downloads(
pool: &Pool<Postgres>,
plugin_id: Uuid,
) -> Result<(), Error>
pub async fn increment_downloads( pool: &Pool<Postgres>, plugin_id: Uuid, ) -> Result<(), Error>
Increment download count
Sourcepub async fn take_down(
pool: &Pool<Postgres>,
plugin_id: Uuid,
reason: Option<&str>,
) -> Result<(), Error>
pub async fn take_down( pool: &Pool<Postgres>, plugin_id: Uuid, reason: Option<&str>, ) -> Result<(), Error>
Mark a plugin as taken-down. The reason is surfaced to admins on the detail view so they remember why moderation acted.
Sourcepub async fn restore(
pool: &Pool<Postgres>,
plugin_id: Uuid,
) -> Result<(), Error>
pub async fn restore( pool: &Pool<Postgres>, plugin_id: Uuid, ) -> Result<(), Error>
Reverse a takedown — clears both the timestamp and the reason so the plugin reappears in search.
Sourcepub async fn list_taken_down(
pool: &Pool<Postgres>,
) -> Result<Vec<Plugin>, Error>
pub async fn list_taken_down( pool: &Pool<Postgres>, ) -> Result<Vec<Plugin>, Error>
Returns every plugin currently flagged as taken-down, newest first. Powers the admin moderation page; the public search filters these out, so this is the only path to find them once a takedown has happened (apart from the per-action audit row).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Plugin
impl<'de> Deserialize<'de> for Plugin
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Plugin, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Plugin, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a, R> FromRow<'a, R> for Pluginwhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
i64: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Decimal: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
i32: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<DateTime<Utc>>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
impl<'a, R> FromRow<'a, R> for Pluginwhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
i64: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Decimal: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
i32: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<DateTime<Utc>>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
DateTime<Utc>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Source§impl Serialize for Plugin
impl Serialize for Plugin
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for Plugin
impl RefUnwindSafe for Plugin
impl Send for Plugin
impl Sync for Plugin
impl Unpin for Plugin
impl UnsafeUnpin for Plugin
impl UnwindSafe for Plugin
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreCreates a shared type from an unshared type.