pub struct Post {
pub id: i64,
pub user_id: i64,
pub title: String,
pub content: String,
pub created_at: i64,
pub updated_at: i64,
}Fields§
§id: i64§user_id: i64§title: String§content: String§created_at: i64§updated_at: i64Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Post
impl<'de> Deserialize<'de> for Post
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<CreatePostRequest> for Post
impl From<CreatePostRequest> for Post
Source§fn from(req: CreatePostRequest) -> Self
fn from(req: CreatePostRequest) -> Self
Converts to this type from the input type.
Source§impl From<Post> for PostResponse
impl From<Post> for PostResponse
Source§impl Model for Post
impl Model for Post
Source§fn table_name() -> &'static str
fn table_name() -> &'static str
Get the table name for the model
Source§fn migrations() -> Vec<Migration>
fn migrations() -> Vec<Migration>
Get the migrations for this model
Source§fn primary_key() -> &'static str
fn primary_key() -> &'static str
Get the primary key name (defaults to “id”)
Source§fn find<'async_trait>(
id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn find<'async_trait>(
id: i64,
) -> Pin<Box<dyn Future<Output = Result<Option<Self>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
Find a model by its primary key
Source§fn all<'async_trait>() -> Pin<Box<dyn Future<Output = Result<Vec<Self>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn all<'async_trait>() -> Pin<Box<dyn Future<Output = Result<Vec<Self>, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
Get all records
Source§fn create<'async_trait>(
model: Self,
) -> Pin<Box<dyn Future<Output = Result<Self, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn create<'async_trait>(
model: Self,
) -> Pin<Box<dyn Future<Output = Result<Self, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
Create a new record
Source§fn get_field_value(&self, field: &str) -> Result<i64, DatabaseError>
fn get_field_value(&self, field: &str) -> Result<i64, DatabaseError>
Get a field value by name (used for relationships)
Source§fn create_validated<'async_trait>(
model: Self,
) -> Pin<Box<dyn Future<Output = Result<Self, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
fn create_validated<'async_trait>(
model: Self,
) -> Pin<Box<dyn Future<Output = Result<Self, DatabaseError>> + Send + 'async_trait>>where
Self: 'async_trait,
Create a new record with validation
Source§impl ModelValidation for Post
impl ModelValidation for Post
Source§impl ValidationRules for Post
impl ValidationRules for Post
fn validate_rules(&self) -> Result<(), ValidationError>
Auto Trait Implementations§
impl Freeze for Post
impl RefUnwindSafe for Post
impl Send for Post
impl Sync for Post
impl Unpin for Post
impl UnwindSafe for Post
Blanket Implementations§
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> InertiaProps for Twhere
T: Serialize,
impl<T> InertiaProps for Twhere
T: Serialize,
fn into_props(self) -> Valuewhere
Self: Sized,
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 more