pub struct Template {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 version: String,
pub category: String,
pub tags: Vec<String>,
pub content_json: Value,
pub readme: Option<String>,
pub example_usage: Option<String>,
pub requirements: Vec<String>,
pub compatibility_json: Value,
pub stats_json: Value,
pub published: bool,
pub verified_at: Option<DateTime<Utc>>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Template model
Fields§
§id: Uuid§org_id: Option<Uuid>§name: String§slug: String§description: String§version: String§category: String§content_json: Value§readme: Option<String>§example_usage: Option<String>§requirements: Vec<String>§compatibility_json: Value§stats_json: Value§published: bool§verified_at: Option<DateTime<Utc>>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl Template
impl Template
Sourcepub fn category(&self) -> TemplateCategory
pub fn category(&self) -> TemplateCategory
Get category as enum
Sourcepub async fn create(
pool: &Pool<Postgres>,
org_id: Option<Uuid>,
name: &str,
slug: &str,
description: &str,
author_id: Uuid,
version: &str,
category: TemplateCategory,
content_json: Value,
) -> Result<Template, Error>
pub async fn create( pool: &Pool<Postgres>, org_id: Option<Uuid>, name: &str, slug: &str, description: &str, author_id: Uuid, version: &str, category: TemplateCategory, content_json: Value, ) -> Result<Template, Error>
Create a new template
Sourcepub async fn find_by_id(
pool: &Pool<Postgres>,
id: Uuid,
) -> Result<Option<Template>, Error>
pub async fn find_by_id( pool: &Pool<Postgres>, id: Uuid, ) -> Result<Option<Template>, Error>
Find by ID
Sourcepub async fn find_by_name_version(
pool: &Pool<Postgres>,
name: &str,
version: &str,
) -> Result<Option<Template>, Error>
pub async fn find_by_name_version( pool: &Pool<Postgres>, name: &str, version: &str, ) -> Result<Option<Template>, Error>
Find by name and version
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 templates matching search criteria
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Template
impl<'de> Deserialize<'de> for Template
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Template, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Template, <__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 Templatewhere
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>,
Value: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
bool: 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 Templatewhere
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>,
Value: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
Option<String>: Decode<'a, <R as Row>::Database> + Type<<R as Row>::Database>,
bool: 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 Template
impl Serialize for Template
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 Template
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnsafeUnpin for Template
impl UnwindSafe for Template
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.