-
I have a table like this: CREATE TABLE job_queue (
scheduled_time TIMESTAMPTZ NOT NULL,
name TEXT NOT NULL,
PRIMARY KEY (scheduled_time, name)
); I would like to create a #[derive(Insertable, Queryable, Selectable, Identifiable, AsChangeset, Clone, Debug)]
#[diesel(table_name = crate::schema::job_queue)]
#[diesel(primary_key(scheduled_time, name))]
#[diesel(check_for_backend(diesel::pg::Pg))]
pub struct InProgressJob {
scheduled_time: DateTime<Utc>,
start_time: DateTime<Utc>,
name: String,
} How do I use this as the return type of the following SQL, such that SELECT (scheduled_time, NOW(), name) FROM job_queue LIMIT 10; |
Beta Was this translation helpful? Give feedback.
Answered by
weiznich
Aug 11, 2023
Replies: 1 comment 2 replies
-
See the last example in the documentation. The expression can be freely chosen. The type must match the expression. |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
ISibboI
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See the last example in the documentation. The expression can be freely chosen. The type must match the expression.