split rs files
This commit is contained in:
+40
-47
@@ -1,3 +1,5 @@
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum FileOwnerKind {
|
||||
Pad,
|
||||
@@ -113,13 +115,15 @@ async fn list_files(
|
||||
owner_id: i64,
|
||||
) -> Result<Vec<NoteFile>, sqlx::Error> {
|
||||
if pool.kind() == DatabaseKind::Sqlite {
|
||||
return Ok(sqlx::query_as::<_, SqliteNoteFile>(queries::get(pool.kind(), query))
|
||||
.bind(owner_id)
|
||||
.fetch_all(pool.pool())
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(NoteFile::from)
|
||||
.collect());
|
||||
return Ok(
|
||||
sqlx::query_as::<_, SqliteNoteFile>(queries::get(pool.kind(), query))
|
||||
.bind(owner_id)
|
||||
.fetch_all(pool.pool())
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(NoteFile::from)
|
||||
.collect(),
|
||||
);
|
||||
}
|
||||
sqlx::query_as::<_, NoteFile>(queries::get(pool.kind(), query))
|
||||
.bind(owner_id)
|
||||
@@ -194,12 +198,14 @@ pub async fn find_note_file(
|
||||
file_id: i64,
|
||||
) -> Result<Option<NoteFile>, sqlx::Error> {
|
||||
if pool.kind() == DatabaseKind::Sqlite {
|
||||
return Ok(sqlx::query_as::<_, SqliteNoteFile>(queries::get(pool.kind(), queries::Q038))
|
||||
.bind(file_id)
|
||||
.bind(note_id)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.map(NoteFile::from));
|
||||
return Ok(
|
||||
sqlx::query_as::<_, SqliteNoteFile>(queries::get(pool.kind(), queries::Q038))
|
||||
.bind(file_id)
|
||||
.bind(note_id)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.map(NoteFile::from),
|
||||
);
|
||||
}
|
||||
sqlx::query_as::<_, NoteFile>(queries::get(pool.kind(), queries::Q038))
|
||||
.bind(file_id)
|
||||
@@ -227,12 +233,14 @@ pub async fn find_pad_file(
|
||||
file_id: i64,
|
||||
) -> Result<Option<NoteFile>, sqlx::Error> {
|
||||
if pool.kind() == DatabaseKind::Sqlite {
|
||||
return Ok(sqlx::query_as::<_, SqliteNoteFile>(queries::get(pool.kind(), queries::Q046))
|
||||
.bind(file_id)
|
||||
.bind(pad_id)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.map(NoteFile::from));
|
||||
return Ok(
|
||||
sqlx::query_as::<_, SqliteNoteFile>(queries::get(pool.kind(), queries::Q046))
|
||||
.bind(file_id)
|
||||
.bind(pad_id)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.map(NoteFile::from),
|
||||
);
|
||||
}
|
||||
sqlx::query_as::<_, NoteFile>(queries::get(pool.kind(), queries::Q046))
|
||||
.bind(file_id)
|
||||
@@ -255,33 +263,18 @@ pub async fn delete_pad_file(
|
||||
}
|
||||
|
||||
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for Workspace {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
Ok(Self { id: row.try_get("id")?, slug: crate::row_decode::text(row, "slug")?, title: crate::row_decode::text(row, "title")?, password_hash: crate::row_decode::optional_text(row, "password_hash")?, created_at: crate::row_decode::text(row, "created_at")?, updated_at: crate::row_decode::text(row, "updated_at")?, is_private: row.try_get("is_private")? })
|
||||
}
|
||||
}
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for Note {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
let protected: i64 = row.try_get("protected")?;
|
||||
Ok(Self { id: row.try_get("id")?, _workspace_id: row.try_get("workspace_id")?, slug: crate::row_decode::text(row, "slug")?, title: crate::row_decode::text(row, "title")?, content: crate::row_decode::text(row, "content")?, created_at: crate::row_decode::text(row, "created_at")?, updated_at: crate::row_decode::text(row, "updated_at")?, owner_map: crate::row_decode::text(row, "owner_map")?, protected: protected != 0, created_by: crate::row_decode::optional_text(row, "created_by")? })
|
||||
}
|
||||
}
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for Revision {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
Ok(Self { id: row.try_get("id")?, content: crate::row_decode::text(row, "content")?, created_at: crate::row_decode::text(row, "created_at")?, author: crate::row_decode::optional_text(row, "author")?, owner_map: crate::row_decode::text(row, "owner_map")? })
|
||||
}
|
||||
}
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for Pad {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
Ok(Self { id: row.try_get("id")?, slug: crate::row_decode::text(row, "slug")?, title: crate::row_decode::text(row, "title")?, content: crate::row_decode::text(row, "content")?, password_hash: crate::row_decode::optional_text(row, "password_hash")?, created_at: crate::row_decode::text(row, "created_at")?, updated_at: crate::row_decode::text(row, "updated_at")?, owner_map: crate::row_decode::text(row, "owner_map")?, is_private: row.try_get("is_private")? })
|
||||
}
|
||||
}
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for PublishedPageRow {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> { Ok(Self { token: crate::row_decode::text(row,"token")?, pad_id: row.try_get("pad_id")?, note_id: row.try_get("note_id")?, allow_task_updates: row.try_get("allow_task_updates")?, title: crate::row_decode::text(row,"title")?, content: crate::row_decode::text(row,"content")?, updated_at: crate::row_decode::text(row,"updated_at")? }) }
|
||||
}
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for PostgresPublishedPageRow {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> { Ok(Self { token: crate::row_decode::text(row,"token")?, pad_id: row.try_get("pad_id")?, note_id: row.try_get("note_id")?, allow_task_updates: row.try_get("allow_task_updates")?, title: crate::row_decode::text(row,"title")?, content: crate::row_decode::text(row,"content")?, updated_at: crate::row_decode::text(row,"updated_at")? }) }
|
||||
}
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for NoteFile {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> { let attached:i64=row.try_get("is_attached")?; Ok(Self { id:row.try_get("id")?, filename:crate::row_decode::text(row,"filename")?, url:crate::row_decode::text(row,"url")?, mime_type:crate::row_decode::text(row,"mime_type")?, size_bytes:row.try_get("size_bytes")?, created_at:crate::row_decode::text(row,"created_at")?, is_attached:attached!=0, detached_at:crate::row_decode::optional_text(row,"detached_at")? }) }
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
let attached: i64 = row.try_get("is_attached")?;
|
||||
Ok(Self {
|
||||
id: row.try_get("id")?,
|
||||
filename: crate::row_decode::text(row, "filename")?,
|
||||
url: crate::row_decode::text(row, "url")?,
|
||||
mime_type: crate::row_decode::text(row, "mime_type")?,
|
||||
size_bytes: row.try_get("size_bytes")?,
|
||||
created_at: crate::row_decode::text(row, "created_at")?,
|
||||
is_attached: attached != 0,
|
||||
detached_at: crate::row_decode::optional_text(row, "detached_at")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+458
-4
@@ -7,9 +7,463 @@ use chrono::{DateTime, NaiveDateTime, Utc};
|
||||
use rand_core::{OsRng, RngCore};
|
||||
use serde::Serialize;
|
||||
use sqlx::FromRow;
|
||||
use sqlx::{any::AnyRow, Any, Row, Transaction};
|
||||
use sqlx::{Any, Row, Transaction, any::AnyRow};
|
||||
|
||||
mod files;
|
||||
mod public_pages;
|
||||
|
||||
pub use files::*;
|
||||
pub use public_pages::*;
|
||||
|
||||
async fn inserted_id(
|
||||
kind: DatabaseKind,
|
||||
tx: &mut Transaction<'_, Any>,
|
||||
table: &str,
|
||||
) -> Result<i64, sqlx::Error> {
|
||||
let query = match kind {
|
||||
DatabaseKind::Sqlite => queries::get(kind, queries::SQLITE_LAST_INSERT_ID),
|
||||
DatabaseKind::MySql => queries::get(kind, queries::MYSQL_LAST_INSERT_ID),
|
||||
DatabaseKind::Postgres => match table {
|
||||
"note_revisions" => queries::get(kind, queries::POSTGRES_NOTE_REVISION_LAST_INSERT_ID),
|
||||
"revisions" => queries::get(kind, queries::POSTGRES_PAD_REVISION_LAST_INSERT_ID),
|
||||
_ => unreachable!("unsupported identity table"),
|
||||
},
|
||||
};
|
||||
sqlx::query_scalar(query).fetch_one(&mut **tx).await
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Workspace {
|
||||
pub id: i64,
|
||||
pub slug: String,
|
||||
pub title: String,
|
||||
pub password_hash: Option<String>,
|
||||
pub created_at: String,
|
||||
pub updated_at: String,
|
||||
pub is_private: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct Note {
|
||||
pub id: i64,
|
||||
#[serde(skip_serializing)]
|
||||
pub _workspace_id: i64,
|
||||
pub slug: String,
|
||||
pub title: String,
|
||||
#[serde(skip_serializing)]
|
||||
pub content: String,
|
||||
pub created_at: String,
|
||||
pub updated_at: String,
|
||||
pub owner_map: String,
|
||||
pub protected: bool,
|
||||
pub created_by: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, FromRow)]
|
||||
struct SqliteNote {
|
||||
id: i64,
|
||||
workspace_id: i64,
|
||||
slug: String,
|
||||
title: String,
|
||||
content: String,
|
||||
created_at: String,
|
||||
updated_at: String,
|
||||
owner_map: String,
|
||||
protected: i64,
|
||||
created_by: Option<String>,
|
||||
}
|
||||
|
||||
impl From<SqliteNote> for Note {
|
||||
fn from(value: SqliteNote) -> Self {
|
||||
Self {
|
||||
id: value.id,
|
||||
_workspace_id: value.workspace_id,
|
||||
slug: value.slug,
|
||||
title: value.title,
|
||||
content: value.content,
|
||||
created_at: value.created_at,
|
||||
updated_at: value.updated_at,
|
||||
owner_map: value.owner_map,
|
||||
protected: value.protected != 0,
|
||||
created_by: value.created_by,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Revision {
|
||||
pub id: i64,
|
||||
pub content: String,
|
||||
pub created_at: String,
|
||||
pub author: Option<String>,
|
||||
pub owner_map: String,
|
||||
}
|
||||
|
||||
pub async fn find_workspace(pool: &Database, slug: &str) -> Result<Option<Workspace>, sqlx::Error> {
|
||||
sqlx::query_as::<_, Workspace>(queries::get(pool.kind(), queries::Q001))
|
||||
.bind(slug)
|
||||
.fetch_optional(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn create_workspace(
|
||||
pool: &Database,
|
||||
slug: &str,
|
||||
title: &str,
|
||||
password: Option<&str>,
|
||||
) -> Result<Workspace, sqlx::Error> {
|
||||
let password_hash = password
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(hash_password);
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q002))
|
||||
.bind(slug)
|
||||
.bind(title)
|
||||
.bind(password_hash)
|
||||
.execute(pool.pool())
|
||||
.await?;
|
||||
|
||||
sqlx::query_as::<_, Workspace>(queries::get(pool.kind(), queries::Q001))
|
||||
.bind(slug)
|
||||
.fetch_one(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub fn verify_workspace_password(workspace: &Workspace, password: Option<&str>) -> bool {
|
||||
match (
|
||||
&workspace.password_hash,
|
||||
password.filter(|value| !value.is_empty()),
|
||||
) {
|
||||
(None, _) => true,
|
||||
(Some(hash), Some(password)) => PasswordHash::new(hash)
|
||||
.ok()
|
||||
.and_then(|parsed| {
|
||||
Argon2::default()
|
||||
.verify_password(password.as_bytes(), &parsed)
|
||||
.ok()
|
||||
})
|
||||
.is_some(),
|
||||
(Some(_), None) => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn list_notes(pool: &Database, workspace_id: i64) -> Result<Vec<Note>, sqlx::Error> {
|
||||
if pool.kind() == DatabaseKind::Sqlite {
|
||||
return Ok(
|
||||
sqlx::query_as::<_, SqliteNote>(queries::get(pool.kind(), queries::Q003))
|
||||
.bind(workspace_id)
|
||||
.fetch_all(pool.pool())
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(Note::from)
|
||||
.collect(),
|
||||
);
|
||||
}
|
||||
sqlx::query_as::<_, Note>(queries::get(pool.kind(), queries::Q003))
|
||||
.bind(workspace_id)
|
||||
.fetch_all(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn find_note(
|
||||
pool: &Database,
|
||||
workspace_id: i64,
|
||||
slug: &str,
|
||||
) -> Result<Option<Note>, sqlx::Error> {
|
||||
if pool.kind() == DatabaseKind::Sqlite {
|
||||
return Ok(
|
||||
sqlx::query_as::<_, SqliteNote>(queries::get(pool.kind(), queries::Q004))
|
||||
.bind(workspace_id)
|
||||
.bind(slug)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.map(Note::from),
|
||||
);
|
||||
}
|
||||
sqlx::query_as::<_, Note>(queries::get(pool.kind(), queries::Q004))
|
||||
.bind(workspace_id)
|
||||
.bind(slug)
|
||||
.fetch_optional(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn create_note(
|
||||
pool: &Database,
|
||||
workspace_id: i64,
|
||||
slug: &str,
|
||||
title: &str,
|
||||
protected: bool,
|
||||
created_by: Option<&str>,
|
||||
) -> Result<Note, sqlx::Error> {
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q005))
|
||||
.bind(workspace_id)
|
||||
.bind(slug)
|
||||
.bind(title)
|
||||
.bind(protected)
|
||||
.bind(created_by)
|
||||
.execute(pool.pool())
|
||||
.await?;
|
||||
|
||||
find_note(pool, workspace_id, slug)
|
||||
.await?
|
||||
.ok_or(sqlx::Error::RowNotFound)
|
||||
}
|
||||
|
||||
pub async fn save_revision(
|
||||
pool: &Database,
|
||||
note_id: i64,
|
||||
workspace_id: i64,
|
||||
content: &str,
|
||||
author: Option<&str>,
|
||||
owner_map: &str,
|
||||
) -> Result<(i64, String), sqlx::Error> {
|
||||
let mut tx = pool.pool().begin().await?;
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q006))
|
||||
.bind(content)
|
||||
.bind(owner_map)
|
||||
.bind(note_id)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q007))
|
||||
.bind(workspace_id)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q008))
|
||||
.bind(note_id)
|
||||
.bind(content)
|
||||
.bind(author)
|
||||
.bind(owner_map)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
let revision_id = inserted_id(pool.kind(), &mut tx, "note_revisions").await?;
|
||||
let updated_at: String = sqlx::query_scalar(queries::get(pool.kind(), queries::Q009))
|
||||
.bind(note_id)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?;
|
||||
tx.commit().await?;
|
||||
Ok((revision_id, updated_at))
|
||||
}
|
||||
|
||||
pub async fn list_revisions(pool: &Database, note_id: i64) -> Result<Vec<Revision>, sqlx::Error> {
|
||||
sqlx::query_as::<_, Revision>(queries::get(pool.kind(), queries::Q010))
|
||||
.bind(note_id)
|
||||
.fetch_all(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub fn random_suffix(length: usize) -> String {
|
||||
const ALPHABET: &[u8] = b"abcdefghjkmnpqrstuvwxyz23456789";
|
||||
let mut bytes = vec![0_u8; length];
|
||||
let mut rng = OsRng;
|
||||
rng.fill_bytes(&mut bytes);
|
||||
bytes
|
||||
.into_iter()
|
||||
.map(|value| ALPHABET[(value as usize) % ALPHABET.len()] as char)
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn hash_password(password: &str) -> String {
|
||||
let salt = SaltString::generate(&mut OsRng);
|
||||
Argon2::default()
|
||||
.hash_password(password.as_bytes(), &salt)
|
||||
.expect("Argon2 hashing should succeed")
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn normalize_timestamp(value: &str) -> String {
|
||||
let value = value.trim();
|
||||
|
||||
if let Ok(timestamp) = DateTime::parse_from_rfc3339(value) {
|
||||
return timestamp.with_timezone(&Utc).to_rfc3339();
|
||||
}
|
||||
|
||||
// PostgreSQL renders TEXT timestamps as e.g. `2026-07-20 14:32:10.123456+00`.
|
||||
// RFC 3339 requires `T` and a colon in the numeric offset.
|
||||
let mut postgres = value.replacen(' ', "T", 1);
|
||||
if postgres.len() >= 3 {
|
||||
let offset_start = postgres.len() - 3;
|
||||
let offset = &postgres[offset_start..];
|
||||
if (offset.starts_with('+') || offset.starts_with('-'))
|
||||
&& offset[1..]
|
||||
.chars()
|
||||
.all(|character| character.is_ascii_digit())
|
||||
{
|
||||
postgres.push_str(":00");
|
||||
}
|
||||
}
|
||||
if let Ok(timestamp) = DateTime::parse_from_rfc3339(&postgres) {
|
||||
return timestamp.with_timezone(&Utc).to_rfc3339();
|
||||
}
|
||||
|
||||
for format in ["%Y-%m-%d %H:%M:%S%.f%:z", "%Y-%m-%dT%H:%M:%S%.f%:z"] {
|
||||
if let Ok(timestamp) = DateTime::parse_from_str(value, format) {
|
||||
return timestamp.with_timezone(&Utc).to_rfc3339();
|
||||
}
|
||||
}
|
||||
|
||||
for format in ["%Y-%m-%d %H:%M:%S%.f", "%Y-%m-%dT%H:%M:%S%.f"] {
|
||||
if let Ok(timestamp) = NaiveDateTime::parse_from_str(value, format) {
|
||||
return timestamp.and_utc().to_rfc3339();
|
||||
}
|
||||
}
|
||||
|
||||
// Existing rows should still be readable even if they were stored without a zone.
|
||||
value.to_string()
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Pad {
|
||||
pub id: i64,
|
||||
pub slug: String,
|
||||
pub title: String,
|
||||
pub content: String,
|
||||
pub password_hash: Option<String>,
|
||||
pub created_at: String,
|
||||
pub updated_at: String,
|
||||
pub owner_map: String,
|
||||
pub is_private: i64,
|
||||
}
|
||||
|
||||
pub async fn find_pad(pool: &Database, slug: &str) -> Result<Option<Pad>, sqlx::Error> {
|
||||
sqlx::query_as::<_, Pad>(queries::get(pool.kind(), queries::Q011))
|
||||
.bind(slug)
|
||||
.fetch_optional(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn create_pad(
|
||||
pool: &Database,
|
||||
slug: &str,
|
||||
title: &str,
|
||||
password: Option<&str>,
|
||||
) -> Result<Pad, sqlx::Error> {
|
||||
let password_hash = password
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(hash_password);
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q012))
|
||||
.bind(slug)
|
||||
.bind(title)
|
||||
.bind(password_hash)
|
||||
.execute(pool.pool())
|
||||
.await?;
|
||||
|
||||
sqlx::query_as::<_, Pad>(queries::get(pool.kind(), queries::Q011))
|
||||
.bind(slug)
|
||||
.fetch_one(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub fn verify_pad_password(pad: &Pad, password: Option<&str>) -> bool {
|
||||
match (
|
||||
&pad.password_hash,
|
||||
password.filter(|value| !value.is_empty()),
|
||||
) {
|
||||
(None, _) => true,
|
||||
(Some(hash), Some(password)) => PasswordHash::new(hash)
|
||||
.ok()
|
||||
.and_then(|parsed| {
|
||||
Argon2::default()
|
||||
.verify_password(password.as_bytes(), &parsed)
|
||||
.ok()
|
||||
})
|
||||
.is_some(),
|
||||
(Some(_), None) => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn save_pad_revision(
|
||||
pool: &Database,
|
||||
pad_id: i64,
|
||||
content: &str,
|
||||
author: Option<&str>,
|
||||
owner_map: &str,
|
||||
) -> Result<(i64, String), sqlx::Error> {
|
||||
let mut tx = pool.pool().begin().await?;
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q013))
|
||||
.bind(content)
|
||||
.bind(owner_map)
|
||||
.bind(pad_id)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q014))
|
||||
.bind(pad_id)
|
||||
.bind(content)
|
||||
.bind(author)
|
||||
.bind(owner_map)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
let revision_id = inserted_id(pool.kind(), &mut tx, "revisions").await?;
|
||||
let updated_at: String = sqlx::query_scalar(queries::get(pool.kind(), queries::Q015))
|
||||
.bind(pad_id)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?;
|
||||
tx.commit().await?;
|
||||
Ok((revision_id, updated_at))
|
||||
}
|
||||
|
||||
pub async fn list_pad_revisions(
|
||||
pool: &Database,
|
||||
pad_id: i64,
|
||||
) -> Result<Vec<Revision>, sqlx::Error> {
|
||||
sqlx::query_as::<_, Revision>(queries::get(pool.kind(), queries::Q016))
|
||||
.bind(pad_id)
|
||||
.fetch_all(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
include!("workspace_notes.rs");
|
||||
include!("pads_public.rs");
|
||||
include!("files.rs");
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for Workspace {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
Ok(Self {
|
||||
id: row.try_get("id")?,
|
||||
slug: crate::row_decode::text(row, "slug")?,
|
||||
title: crate::row_decode::text(row, "title")?,
|
||||
password_hash: crate::row_decode::optional_text(row, "password_hash")?,
|
||||
created_at: crate::row_decode::text(row, "created_at")?,
|
||||
updated_at: crate::row_decode::text(row, "updated_at")?,
|
||||
is_private: row.try_get("is_private")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for Note {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
let protected: i64 = row.try_get("protected")?;
|
||||
Ok(Self {
|
||||
id: row.try_get("id")?,
|
||||
_workspace_id: row.try_get("workspace_id")?,
|
||||
slug: crate::row_decode::text(row, "slug")?,
|
||||
title: crate::row_decode::text(row, "title")?,
|
||||
content: crate::row_decode::text(row, "content")?,
|
||||
created_at: crate::row_decode::text(row, "created_at")?,
|
||||
updated_at: crate::row_decode::text(row, "updated_at")?,
|
||||
owner_map: crate::row_decode::text(row, "owner_map")?,
|
||||
protected: protected != 0,
|
||||
created_by: crate::row_decode::optional_text(row, "created_by")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for Revision {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
Ok(Self {
|
||||
id: row.try_get("id")?,
|
||||
content: crate::row_decode::text(row, "content")?,
|
||||
created_at: crate::row_decode::text(row, "created_at")?,
|
||||
author: crate::row_decode::optional_text(row, "author")?,
|
||||
owner_map: crate::row_decode::text(row, "owner_map")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for Pad {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
Ok(Self {
|
||||
id: row.try_get("id")?,
|
||||
slug: crate::row_decode::text(row, "slug")?,
|
||||
title: crate::row_decode::text(row, "title")?,
|
||||
content: crate::row_decode::text(row, "content")?,
|
||||
password_hash: crate::row_decode::optional_text(row, "password_hash")?,
|
||||
created_at: crate::row_decode::text(row, "created_at")?,
|
||||
updated_at: crate::row_decode::text(row, "updated_at")?,
|
||||
owner_map: crate::row_decode::text(row, "owner_map")?,
|
||||
is_private: row.try_get("is_private")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,102 +1,4 @@
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Pad {
|
||||
pub id: i64,
|
||||
pub slug: String,
|
||||
pub title: String,
|
||||
pub content: String,
|
||||
pub password_hash: Option<String>,
|
||||
pub created_at: String,
|
||||
pub updated_at: String,
|
||||
pub owner_map: String,
|
||||
pub is_private: i64,
|
||||
}
|
||||
|
||||
pub async fn find_pad(pool: &Database, slug: &str) -> Result<Option<Pad>, sqlx::Error> {
|
||||
sqlx::query_as::<_, Pad>(queries::get(pool.kind(), queries::Q011))
|
||||
.bind(slug)
|
||||
.fetch_optional(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn create_pad(
|
||||
pool: &Database,
|
||||
slug: &str,
|
||||
title: &str,
|
||||
password: Option<&str>,
|
||||
) -> Result<Pad, sqlx::Error> {
|
||||
let password_hash = password
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(hash_password);
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q012))
|
||||
.bind(slug)
|
||||
.bind(title)
|
||||
.bind(password_hash)
|
||||
.execute(pool.pool())
|
||||
.await?;
|
||||
|
||||
sqlx::query_as::<_, Pad>(queries::get(pool.kind(), queries::Q011))
|
||||
.bind(slug)
|
||||
.fetch_one(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub fn verify_pad_password(pad: &Pad, password: Option<&str>) -> bool {
|
||||
match (
|
||||
&pad.password_hash,
|
||||
password.filter(|value| !value.is_empty()),
|
||||
) {
|
||||
(None, _) => true,
|
||||
(Some(hash), Some(password)) => PasswordHash::new(hash)
|
||||
.ok()
|
||||
.and_then(|parsed| {
|
||||
Argon2::default()
|
||||
.verify_password(password.as_bytes(), &parsed)
|
||||
.ok()
|
||||
})
|
||||
.is_some(),
|
||||
(Some(_), None) => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn save_pad_revision(
|
||||
pool: &Database,
|
||||
pad_id: i64,
|
||||
content: &str,
|
||||
author: Option<&str>,
|
||||
owner_map: &str,
|
||||
) -> Result<(i64, String), sqlx::Error> {
|
||||
let mut tx = pool.pool().begin().await?;
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q013))
|
||||
.bind(content)
|
||||
.bind(owner_map)
|
||||
.bind(pad_id)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q014))
|
||||
.bind(pad_id)
|
||||
.bind(content)
|
||||
.bind(author)
|
||||
.bind(owner_map)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
let revision_id = inserted_id(pool.kind(), &mut tx, "revisions").await?;
|
||||
let updated_at: String = sqlx::query_scalar(queries::get(pool.kind(), queries::Q015))
|
||||
.bind(pad_id)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?;
|
||||
tx.commit().await?;
|
||||
Ok((revision_id, updated_at))
|
||||
}
|
||||
|
||||
pub async fn list_pad_revisions(
|
||||
pool: &Database,
|
||||
pad_id: i64,
|
||||
) -> Result<Vec<Revision>, sqlx::Error> {
|
||||
sqlx::query_as::<_, Revision>(queries::get(pool.kind(), queries::Q016))
|
||||
.bind(pad_id)
|
||||
.fetch_all(pool.pool())
|
||||
.await
|
||||
}
|
||||
use super::*;
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct PublishedPage {
|
||||
@@ -197,13 +99,14 @@ pub async fn find_published_page(
|
||||
token: &str,
|
||||
) -> Result<Option<PublishedPage>, sqlx::Error> {
|
||||
if pool.kind() == DatabaseKind::Postgres {
|
||||
return Ok(
|
||||
sqlx::query_as::<_, PostgresPublishedPageRow>(queries::get(pool.kind(), queries::Q021))
|
||||
.bind(token)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.map(Into::into),
|
||||
);
|
||||
return Ok(sqlx::query_as::<_, PostgresPublishedPageRow>(queries::get(
|
||||
pool.kind(),
|
||||
queries::Q021,
|
||||
))
|
||||
.bind(token)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.map(Into::into));
|
||||
}
|
||||
Ok(
|
||||
sqlx::query_as::<_, PublishedPageRow>(queries::get(pool.kind(), queries::Q021))
|
||||
@@ -216,11 +119,13 @@ pub async fn find_published_page(
|
||||
|
||||
pub async fn pad_public_task_updates(pool: &Database, pad_id: i64) -> Result<bool, sqlx::Error> {
|
||||
if pool.kind() == DatabaseKind::Postgres {
|
||||
return Ok(sqlx::query_scalar::<_, bool>(queries::get(pool.kind(), queries::Q044))
|
||||
.bind(pad_id)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.unwrap_or(false));
|
||||
return Ok(
|
||||
sqlx::query_scalar::<_, bool>(queries::get(pool.kind(), queries::Q044))
|
||||
.bind(pad_id)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.unwrap_or(false),
|
||||
);
|
||||
}
|
||||
let value = sqlx::query_scalar::<_, i64>(queries::get(pool.kind(), queries::Q044))
|
||||
.bind(pad_id)
|
||||
@@ -232,11 +137,13 @@ pub async fn pad_public_task_updates(pool: &Database, pad_id: i64) -> Result<boo
|
||||
|
||||
pub async fn note_public_task_updates(pool: &Database, note_id: i64) -> Result<bool, sqlx::Error> {
|
||||
if pool.kind() == DatabaseKind::Postgres {
|
||||
return Ok(sqlx::query_scalar::<_, bool>(queries::get(pool.kind(), queries::Q045))
|
||||
.bind(note_id)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.unwrap_or(false));
|
||||
return Ok(
|
||||
sqlx::query_scalar::<_, bool>(queries::get(pool.kind(), queries::Q045))
|
||||
.bind(note_id)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.unwrap_or(false),
|
||||
);
|
||||
}
|
||||
let value = sqlx::query_scalar::<_, i64>(queries::get(pool.kind(), queries::Q045))
|
||||
.bind(note_id)
|
||||
@@ -377,3 +284,30 @@ pub async fn note_file_token(pool: &Database, note_id: i64) -> Result<String, sq
|
||||
.await
|
||||
}
|
||||
|
||||
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for PublishedPageRow {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
Ok(Self {
|
||||
token: crate::row_decode::text(row, "token")?,
|
||||
pad_id: row.try_get("pad_id")?,
|
||||
note_id: row.try_get("note_id")?,
|
||||
allow_task_updates: row.try_get("allow_task_updates")?,
|
||||
title: crate::row_decode::text(row, "title")?,
|
||||
content: crate::row_decode::text(row, "content")?,
|
||||
updated_at: crate::row_decode::text(row, "updated_at")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
impl<'r> sqlx::FromRow<'r, AnyRow> for PostgresPublishedPageRow {
|
||||
fn from_row(row: &'r AnyRow) -> Result<Self, sqlx::Error> {
|
||||
Ok(Self {
|
||||
token: crate::row_decode::text(row, "token")?,
|
||||
pad_id: row.try_get("pad_id")?,
|
||||
note_id: row.try_get("note_id")?,
|
||||
allow_task_updates: row.try_get("allow_task_updates")?,
|
||||
title: crate::row_decode::text(row, "title")?,
|
||||
content: crate::row_decode::text(row, "content")?,
|
||||
updated_at: crate::row_decode::text(row, "updated_at")?,
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -1,291 +0,0 @@
|
||||
async fn inserted_id(
|
||||
kind: DatabaseKind,
|
||||
tx: &mut Transaction<'_, Any>,
|
||||
table: &str,
|
||||
) -> Result<i64, sqlx::Error> {
|
||||
let query = match kind {
|
||||
DatabaseKind::Sqlite => queries::get(kind, queries::SQLITE_LAST_INSERT_ID),
|
||||
DatabaseKind::MySql => queries::get(kind, queries::MYSQL_LAST_INSERT_ID),
|
||||
DatabaseKind::Postgres => match table {
|
||||
"note_revisions" => queries::get(kind, queries::POSTGRES_NOTE_REVISION_LAST_INSERT_ID),
|
||||
"revisions" => queries::get(kind, queries::POSTGRES_PAD_REVISION_LAST_INSERT_ID),
|
||||
_ => unreachable!("unsupported identity table"),
|
||||
},
|
||||
};
|
||||
sqlx::query_scalar(query).fetch_one(&mut **tx).await
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Workspace {
|
||||
pub id: i64,
|
||||
pub slug: String,
|
||||
pub title: String,
|
||||
pub password_hash: Option<String>,
|
||||
pub created_at: String,
|
||||
pub updated_at: String,
|
||||
pub is_private: i64,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct Note {
|
||||
pub id: i64,
|
||||
#[serde(skip_serializing)]
|
||||
pub _workspace_id: i64,
|
||||
pub slug: String,
|
||||
pub title: String,
|
||||
#[serde(skip_serializing)]
|
||||
pub content: String,
|
||||
pub created_at: String,
|
||||
pub updated_at: String,
|
||||
pub owner_map: String,
|
||||
pub protected: bool,
|
||||
pub created_by: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, FromRow)]
|
||||
struct SqliteNote {
|
||||
id: i64,
|
||||
workspace_id: i64,
|
||||
slug: String,
|
||||
title: String,
|
||||
content: String,
|
||||
created_at: String,
|
||||
updated_at: String,
|
||||
owner_map: String,
|
||||
protected: i64,
|
||||
created_by: Option<String>,
|
||||
}
|
||||
|
||||
impl From<SqliteNote> for Note {
|
||||
fn from(value: SqliteNote) -> Self {
|
||||
Self {
|
||||
id: value.id,
|
||||
_workspace_id: value.workspace_id,
|
||||
slug: value.slug,
|
||||
title: value.title,
|
||||
content: value.content,
|
||||
created_at: value.created_at,
|
||||
updated_at: value.updated_at,
|
||||
owner_map: value.owner_map,
|
||||
protected: value.protected != 0,
|
||||
created_by: value.created_by,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize)]
|
||||
pub struct Revision {
|
||||
pub id: i64,
|
||||
pub content: String,
|
||||
pub created_at: String,
|
||||
pub author: Option<String>,
|
||||
pub owner_map: String,
|
||||
}
|
||||
|
||||
pub async fn find_workspace(pool: &Database, slug: &str) -> Result<Option<Workspace>, sqlx::Error> {
|
||||
sqlx::query_as::<_, Workspace>(queries::get(pool.kind(), queries::Q001))
|
||||
.bind(slug)
|
||||
.fetch_optional(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn create_workspace(
|
||||
pool: &Database,
|
||||
slug: &str,
|
||||
title: &str,
|
||||
password: Option<&str>,
|
||||
) -> Result<Workspace, sqlx::Error> {
|
||||
let password_hash = password
|
||||
.filter(|value| !value.is_empty())
|
||||
.map(hash_password);
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q002))
|
||||
.bind(slug)
|
||||
.bind(title)
|
||||
.bind(password_hash)
|
||||
.execute(pool.pool())
|
||||
.await?;
|
||||
|
||||
sqlx::query_as::<_, Workspace>(queries::get(pool.kind(), queries::Q001))
|
||||
.bind(slug)
|
||||
.fetch_one(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub fn verify_workspace_password(workspace: &Workspace, password: Option<&str>) -> bool {
|
||||
match (
|
||||
&workspace.password_hash,
|
||||
password.filter(|value| !value.is_empty()),
|
||||
) {
|
||||
(None, _) => true,
|
||||
(Some(hash), Some(password)) => PasswordHash::new(hash)
|
||||
.ok()
|
||||
.and_then(|parsed| {
|
||||
Argon2::default()
|
||||
.verify_password(password.as_bytes(), &parsed)
|
||||
.ok()
|
||||
})
|
||||
.is_some(),
|
||||
(Some(_), None) => false,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn list_notes(pool: &Database, workspace_id: i64) -> Result<Vec<Note>, sqlx::Error> {
|
||||
if pool.kind() == DatabaseKind::Sqlite {
|
||||
return Ok(sqlx::query_as::<_, SqliteNote>(queries::get(pool.kind(), queries::Q003))
|
||||
.bind(workspace_id)
|
||||
.fetch_all(pool.pool())
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(Note::from)
|
||||
.collect());
|
||||
}
|
||||
sqlx::query_as::<_, Note>(queries::get(pool.kind(), queries::Q003))
|
||||
.bind(workspace_id)
|
||||
.fetch_all(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn find_note(
|
||||
pool: &Database,
|
||||
workspace_id: i64,
|
||||
slug: &str,
|
||||
) -> Result<Option<Note>, sqlx::Error> {
|
||||
if pool.kind() == DatabaseKind::Sqlite {
|
||||
return Ok(sqlx::query_as::<_, SqliteNote>(queries::get(pool.kind(), queries::Q004))
|
||||
.bind(workspace_id)
|
||||
.bind(slug)
|
||||
.fetch_optional(pool.pool())
|
||||
.await?
|
||||
.map(Note::from));
|
||||
}
|
||||
sqlx::query_as::<_, Note>(queries::get(pool.kind(), queries::Q004))
|
||||
.bind(workspace_id)
|
||||
.bind(slug)
|
||||
.fetch_optional(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn create_note(
|
||||
pool: &Database,
|
||||
workspace_id: i64,
|
||||
slug: &str,
|
||||
title: &str,
|
||||
protected: bool,
|
||||
created_by: Option<&str>,
|
||||
) -> Result<Note, sqlx::Error> {
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q005))
|
||||
.bind(workspace_id)
|
||||
.bind(slug)
|
||||
.bind(title)
|
||||
.bind(protected)
|
||||
.bind(created_by)
|
||||
.execute(pool.pool())
|
||||
.await?;
|
||||
|
||||
find_note(pool, workspace_id, slug)
|
||||
.await?
|
||||
.ok_or(sqlx::Error::RowNotFound)
|
||||
}
|
||||
|
||||
pub async fn save_revision(
|
||||
pool: &Database,
|
||||
note_id: i64,
|
||||
workspace_id: i64,
|
||||
content: &str,
|
||||
author: Option<&str>,
|
||||
owner_map: &str,
|
||||
) -> Result<(i64, String), sqlx::Error> {
|
||||
let mut tx = pool.pool().begin().await?;
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q006))
|
||||
.bind(content)
|
||||
.bind(owner_map)
|
||||
.bind(note_id)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q007))
|
||||
.bind(workspace_id)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
sqlx::query(queries::get(pool.kind(), queries::Q008))
|
||||
.bind(note_id)
|
||||
.bind(content)
|
||||
.bind(author)
|
||||
.bind(owner_map)
|
||||
.execute(&mut *tx)
|
||||
.await?;
|
||||
let revision_id = inserted_id(pool.kind(), &mut tx, "note_revisions").await?;
|
||||
let updated_at: String = sqlx::query_scalar(queries::get(pool.kind(), queries::Q009))
|
||||
.bind(note_id)
|
||||
.fetch_one(&mut *tx)
|
||||
.await?;
|
||||
tx.commit().await?;
|
||||
Ok((revision_id, updated_at))
|
||||
}
|
||||
|
||||
pub async fn list_revisions(pool: &Database, note_id: i64) -> Result<Vec<Revision>, sqlx::Error> {
|
||||
sqlx::query_as::<_, Revision>(queries::get(pool.kind(), queries::Q010))
|
||||
.bind(note_id)
|
||||
.fetch_all(pool.pool())
|
||||
.await
|
||||
}
|
||||
|
||||
pub fn random_suffix(length: usize) -> String {
|
||||
const ALPHABET: &[u8] = b"abcdefghjkmnpqrstuvwxyz23456789";
|
||||
let mut bytes = vec![0_u8; length];
|
||||
let mut rng = OsRng;
|
||||
rng.fill_bytes(&mut bytes);
|
||||
bytes
|
||||
.into_iter()
|
||||
.map(|value| ALPHABET[(value as usize) % ALPHABET.len()] as char)
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn hash_password(password: &str) -> String {
|
||||
let salt = SaltString::generate(&mut OsRng);
|
||||
Argon2::default()
|
||||
.hash_password(password.as_bytes(), &salt)
|
||||
.expect("Argon2 hashing should succeed")
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub fn normalize_timestamp(value: &str) -> String {
|
||||
let value = value.trim();
|
||||
|
||||
if let Ok(timestamp) = DateTime::parse_from_rfc3339(value) {
|
||||
return timestamp.with_timezone(&Utc).to_rfc3339();
|
||||
}
|
||||
|
||||
// PostgreSQL renders TEXT timestamps as e.g. `2026-07-20 14:32:10.123456+00`.
|
||||
// RFC 3339 requires `T` and a colon in the numeric offset.
|
||||
let mut postgres = value.replacen(' ', "T", 1);
|
||||
if postgres.len() >= 3 {
|
||||
let offset_start = postgres.len() - 3;
|
||||
let offset = &postgres[offset_start..];
|
||||
if (offset.starts_with('+') || offset.starts_with('-'))
|
||||
&& offset[1..]
|
||||
.chars()
|
||||
.all(|character| character.is_ascii_digit())
|
||||
{
|
||||
postgres.push_str(":00");
|
||||
}
|
||||
}
|
||||
if let Ok(timestamp) = DateTime::parse_from_rfc3339(&postgres) {
|
||||
return timestamp.with_timezone(&Utc).to_rfc3339();
|
||||
}
|
||||
|
||||
for format in ["%Y-%m-%d %H:%M:%S%.f%:z", "%Y-%m-%dT%H:%M:%S%.f%:z"] {
|
||||
if let Ok(timestamp) = DateTime::parse_from_str(value, format) {
|
||||
return timestamp.with_timezone(&Utc).to_rfc3339();
|
||||
}
|
||||
}
|
||||
|
||||
for format in ["%Y-%m-%d %H:%M:%S%.f", "%Y-%m-%dT%H:%M:%S%.f"] {
|
||||
if let Ok(timestamp) = NaiveDateTime::parse_from_str(value, format) {
|
||||
return timestamp.and_utc().to_rfc3339();
|
||||
}
|
||||
}
|
||||
|
||||
// Existing rows should still be readable even if they were stored without a zone.
|
||||
value.to_string()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user