pub struct Post {
pub id: Uuid,
pub title: String,
pub text: String,
pub user_id: Uuid,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
§テーブル情報
| 項目 | 内容 |
|---|---|
| 論理名 | 投稿テーブル |
| 物理名 | posts |
| 説明 | ユーザーによる投稿情報を格納する。 |
Fields§
§id: Uuid§カラム情報
| 項目 | 内容 |
|---|---|
| 論理名 | 投稿ID |
| 物理名 | id |
| データ型 | UUID |
| 説明 | 投稿を一位に識別するID。 |
| 制約 | PRIMARY KEY, DEFAULT uuid_generate_v7() |
title: String§カラム情報
| 項目 | 内容 |
|---|---|
| 論理名 | タイトル |
| 物理名 | title |
| データ型 | VARCHAR |
| 説明 | 投稿のタイトル。 |
| 制約 | NOT NULL |
text: String§カラム情報
| 項目 | 内容 |
|---|---|
| 論理名 | 本文 |
| 物理名 | text |
| データ型 | TEXT |
| 説明 | 投稿の本文。 |
| 制約 | NOT NULL |
user_id: Uuid§カラム情報
| 項目 | 内容 |
|---|---|
| 論理名 | 投稿者ID |
| 物理名 | user_id |
| データ型 | UUID |
| 説明 | この投稿を作成したユーザーのID。 |
| 制約 | NOT NULL, FK(users.id) |
created_at: DateTime<Utc>§カラム情報
| 項目 | 内容 |
|---|---|
| 論理名 | 作成日時 |
| 物理名 | created_at |
| データ型 | TIMESTAMP WITH TIME ZONE |
| 説明 | レコードが作成された日時。 |
| 制約 | NOT NULL, DEFAULT NOW() |
updated_at: DateTime<Utc>§カラム情報
| 項目 | 内容 |
|---|---|
| 論理名 | 更新日時 |
| 物理名 | updated_at |
| データ型 | TIMESTAMP WITH TIME ZONE |
| 説明 | レコードが最後に更新された日時。 |
| 制約 | NOT NULL, DEFAULT NOW() |
Trait Implementations§
Source§impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB> for Post
impl<__DB: Backend, __ST0, __ST1, __ST2, __ST3, __ST4, __ST5> Queryable<(__ST0, __ST1, __ST2, __ST3, __ST4, __ST5), __DB> for Post
Source§impl<__DB: Backend> Selectable<__DB> for Post
impl<__DB: Backend> Selectable<__DB> for Post
Source§type SelectExpression = (id, title, text, user_id, created_at, updated_at)
type SelectExpression = (id, title, text, user_id, created_at, updated_at)
The expression you’d like to select. Read more
Source§fn construct_selection() -> Self::SelectExpression
fn construct_selection() -> Self::SelectExpression
Construct an instance of the expression
impl Eq for Post
impl StructuralPartialEq for Post
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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§impl<T> IntoSql for T
impl<T> IntoSql for T
§impl<T, DB> SelectableHelper<DB> for Twhere
T: Selectable<DB>,
DB: Backend,
impl<T, DB> SelectableHelper<DB> for Twhere
T: Selectable<DB>,
DB: Backend,
§fn as_select() -> SelectBy<T, DB>
fn as_select() -> SelectBy<T, DB>
Construct a select clause based on a [
Selectable] implementation. Read more§fn as_returning() -> SelectBy<Self, DB>
fn as_returning() -> SelectBy<Self, DB>
An alias for
as_select that can be used with returning clauses§impl<T, ST, DB> StaticallySizedRow<ST, DB> for Twhere
ST: SqlTypeOrSelectable + TupleSize,
T: Queryable<ST, DB>,
DB: Backend,
impl<T, ST, DB> StaticallySizedRow<ST, DB> for Twhere
ST: SqlTypeOrSelectable + TupleSize,
T: Queryable<ST, DB>,
DB: Backend,
§const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE
const FIELD_COUNT: usize = <ST as crate::util::TupleSize>::SIZE
The number of fields that this type will consume.