mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
fix(native): return type casts (#7986)
This commit is contained in:
@@ -336,7 +336,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|||||||
nativeBinding = require('./affine.wasi.cjs')
|
nativeBinding = require('./affine.wasi.cjs')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||||
console.error(err)
|
loadErrors.push(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!nativeBinding) {
|
if (!nativeBinding) {
|
||||||
@@ -344,7 +344,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|||||||
nativeBinding = require('@affine/native-wasm32-wasi')
|
nativeBinding = require('@affine/native-wasm32-wasi')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||||
console.error(err)
|
loadErrors.push(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ impl SqliteConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
pub async fn get_updates_count(&self, doc_id: Option<String>) -> napi::Result<i32> {
|
pub async fn get_updates_count(&self, doc_id: Option<String>) -> napi::Result<i64> {
|
||||||
let count = match doc_id {
|
let count = match doc_id {
|
||||||
Some(doc_id) => {
|
Some(doc_id) => {
|
||||||
sqlx::query!(
|
sqlx::query!(
|
||||||
@@ -185,9 +185,7 @@ impl SqliteConnection {
|
|||||||
.map_err(anyhow::Error::from)?
|
.map_err(anyhow::Error::from)?
|
||||||
.count
|
.count
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
.try_into()
|
|
||||||
.unwrap();
|
|
||||||
Ok(count)
|
Ok(count)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,14 +394,14 @@ impl SqliteConnection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
pub async fn get_max_version(&self) -> napi::Result<i32> {
|
pub async fn get_max_version(&self) -> napi::Result<i64> {
|
||||||
// 4 is the current version
|
// 4 is the current version
|
||||||
let version = sqlx::query!("SELECT COALESCE(MAX(version), 4) AS max_version FROM version_info")
|
let version = sqlx::query!("SELECT COALESCE(MAX(version), 4) AS max_version FROM version_info")
|
||||||
.fetch_one(&self.pool)
|
.fetch_one(&self.pool)
|
||||||
.await
|
.await
|
||||||
.map_err(anyhow::Error::from)?
|
.map_err(anyhow::Error::from)?
|
||||||
.max_version;
|
.max_version;
|
||||||
Ok(version.try_into().unwrap())
|
Ok(version)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
|
|||||||
Reference in New Issue
Block a user