feat(ios): nbstore swift native binding (#9211)

This commit is contained in:
Brooooooklyn
2024-12-27 06:34:30 +00:00
parent 8de0679d70
commit 752e697c6a
40 changed files with 4544 additions and 234 deletions

View File

@@ -1,3 +1,5 @@
use std::ops::Deref;
use super::{storage::SqliteDocStorage, Blob, ListedBlob, SetBlob};
type Result<T> = std::result::Result<T, sqlx::Error>;
@@ -22,7 +24,7 @@ impl SqliteDocStorage {
DO UPDATE SET data=$2, mime=$3, size=$4, deleted_at=NULL;"#,
)
.bind(blob.key)
.bind(blob.data.as_ref())
.bind(blob.data.deref())
.bind(blob.mime)
.bind(blob.data.len() as i64)
.execute(&self.pool)
@@ -67,7 +69,6 @@ impl SqliteDocStorage {
#[cfg(test)]
mod tests {
use napi::bindgen_prelude::Uint8Array;
use sqlx::Row;
use super::*;
@@ -87,7 +88,7 @@ mod tests {
storage
.set_blob(SetBlob {
key: format!("test_{}", i),
data: Uint8Array::from(vec![0, 0]),
data: vec![0, 0].into(),
mime: "text/plain".to_string(),
})
.await
@@ -127,7 +128,7 @@ mod tests {
storage
.set_blob(SetBlob {
key: format!("test_{}", i),
data: Uint8Array::from(vec![0, 0]),
data: vec![0, 0].into(),
mime: "text/plain".to_string(),
})
.await
@@ -175,7 +176,7 @@ mod tests {
storage
.set_blob(SetBlob {
key: format!("test_{}", i),
data: Uint8Array::from(vec![0, 0]),
data: vec![0, 0].into(),
mime: "text/plain".to_string(),
})
.await