pub struct Scenario {Show 19 fields
pub id: Uuid,
pub org_id: Option<Uuid>,
pub name: String,
pub slug: String,
pub description: String,
pub author_id: Uuid,
pub current_version: String,
pub category: String,
pub tags: Vec<String>,
pub license: String,
pub repository: Option<String>,
pub homepage: Option<String>,
pub manifest_json: Value,
pub downloads_total: i64,
pub rating_avg: Decimal,
pub rating_count: i32,
pub verified_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Scenario model
Fields§
§id: Uuid§org_id: Option<Uuid>§name: String§slug: String§description: String§current_version: String§category: String§license: String§repository: Option<String>§homepage: Option<String>§manifest_json: Value§downloads_total: i64§rating_avg: Decimal§rating_count: i32§verified_at: Option<DateTime<Utc>>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl Scenario
impl Scenario
Sourcepub async fn create(
pool: &Pool<Postgres>,
org_id: Option<Uuid>,
name: &str,
slug: &str,
description: &str,
author_id: Uuid,
current_version: &str,
category: &str,
license: &str,
manifest_json: Value,
) -> Result<Scenario, Error>
pub async fn create( pool: &Pool<Postgres>, org_id: Option<Uuid>, name: &str, slug: &str, description: &str, author_id: Uuid, current_version: &str, category: &str, license: &str, manifest_json: Value, ) -> Result<Scenario, Error>
Create a new scenario
Sourcepub async fn find_by_id(
pool: &Pool<Postgres>,
id: Uuid,
) -> Result<Option<Scenario>, Error>
pub async fn find_by_id( pool: &Pool<Postgres>, id: Uuid, ) -> Result<Option<Scenario>, Error>
Find by ID
Sourcepub async fn find_by_name(
pool: &Pool<Postgres>,
name: &str,
) -> Result<Option<Scenario>, Error>
pub async fn find_by_name( pool: &Pool<Postgres>, name: &str, ) -> Result<Option<Scenario>, Error>
Find by name
Sourcepub async fn count_search(
pool: &Pool<Postgres>,
query: Option<&str>,
category: Option<&str>,
tags: &[String],
org_id: Option<Uuid>,
) -> Result<i64, Error>
pub async fn count_search( pool: &Pool<Postgres>, query: Option<&str>, category: Option<&str>, tags: &[String], org_id: Option<Uuid>, ) -> Result<i64, Error>
Count scenarios matching search criteria
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Scenario
impl<'de> Deserialize<'de> for Scenario
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Scenario, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Scenario, <__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 Scenariowhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Uuid>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Vec<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>,
Value: 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 Scenariowhere
R: Row,
&'a str: ColumnIndex<R>,
Uuid: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<Uuid>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
String: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Vec<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>,
Value: 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 Scenario
impl Serialize for Scenario
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 Scenario
impl RefUnwindSafe for Scenario
impl Send for Scenario
impl Sync for Scenario
impl Unpin for Scenario
impl UnsafeUnpin for Scenario
impl UnwindSafe for Scenario
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.