mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00: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')
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
console.error(err)
|
||||
loadErrors.push(err)
|
||||
}
|
||||
}
|
||||
if (!nativeBinding) {
|
||||
@@ -344,7 +344,7 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
||||
nativeBinding = require('@affine/native-wasm32-wasi')
|
||||
} catch (err) {
|
||||
if (process.env.NAPI_RS_FORCE_WASI) {
|
||||
console.error(err)
|
||||
loadErrors.push(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,7 +166,7 @@ impl SqliteConnection {
|
||||
}
|
||||
|
||||
#[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 {
|
||||
Some(doc_id) => {
|
||||
sqlx::query!(
|
||||
@@ -185,9 +185,7 @@ impl SqliteConnection {
|
||||
.map_err(anyhow::Error::from)?
|
||||
.count
|
||||
}
|
||||
}
|
||||
.try_into()
|
||||
.unwrap();
|
||||
};
|
||||
Ok(count)
|
||||
}
|
||||
|
||||
@@ -396,14 +394,14 @@ impl SqliteConnection {
|
||||
}
|
||||
|
||||
#[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
|
||||
let version = sqlx::query!("SELECT COALESCE(MAX(version), 4) AS max_version FROM version_info")
|
||||
.fetch_one(&self.pool)
|
||||
.await
|
||||
.map_err(anyhow::Error::from)?
|
||||
.max_version;
|
||||
Ok(version.try_into().unwrap())
|
||||
Ok(version)
|
||||
}
|
||||
|
||||
#[napi]
|
||||
|
||||
Reference in New Issue
Block a user