chore: remove features that don't compile
add: posts "circle" column
This commit is contained in:
parent
0310418837
commit
50704d27a9
42 changed files with 71 additions and 365 deletions
|
@ -15,15 +15,7 @@ use crate::model::{
|
|||
use tetratto_shared::unix_epoch_timestamp;
|
||||
use crate::{auto_method, DataManager};
|
||||
|
||||
#[cfg(feature = "sqlite")]
|
||||
use oiseau::SqliteRow;
|
||||
|
||||
#[cfg(feature = "postgres")]
|
||||
use oiseau::PostgresRow;
|
||||
|
||||
#[cfg(feature = "redis")]
|
||||
use oiseau::cache::redis::Commands;
|
||||
|
||||
use oiseau::{PostgresRow, cache::redis::Commands};
|
||||
use oiseau::{execute, get, query_row, query_rows, params};
|
||||
|
||||
pub type FullPost = (
|
||||
|
@ -101,10 +93,7 @@ macro_rules! private_post_replying {
|
|||
|
||||
impl DataManager {
|
||||
/// Get a [`Post`] from an SQL row.
|
||||
pub(crate) fn get_post_from_row(
|
||||
#[cfg(feature = "sqlite")] x: &SqliteRow<'_>,
|
||||
#[cfg(feature = "postgres")] x: &PostgresRow,
|
||||
) -> Post {
|
||||
pub(crate) fn get_post_from_row(x: &PostgresRow) -> Post {
|
||||
Post {
|
||||
id: get!(x->0(i64)) as usize,
|
||||
created: get!(x->1(i64)) as usize,
|
||||
|
@ -125,6 +114,7 @@ impl DataManager {
|
|||
poll_id: get!(x->13(i64)) as usize,
|
||||
title: get!(x->14(String)),
|
||||
is_open: get!(x->15(i32)) as i8 == 1,
|
||||
circle: get!(x->16(i64)) as usize,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1620,7 +1610,7 @@ impl DataManager {
|
|||
|
||||
let res = execute!(
|
||||
&conn,
|
||||
"INSERT INTO posts VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, DEFAULT, $13, $14, $15)",
|
||||
"INSERT INTO posts VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, DEFAULT, $13, $14, $15, $16)",
|
||||
params![
|
||||
&(data.id as i64),
|
||||
&(data.created as i64),
|
||||
|
@ -1641,6 +1631,7 @@ impl DataManager {
|
|||
&(data.poll_id as i64),
|
||||
&data.title,
|
||||
&{ if data.is_open { 1 } else { 0 } },
|
||||
&(data.circle as i64),
|
||||
]
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue