From 19e896ff697f47e77769a43ad838535c60de9495 Mon Sep 17 00:00:00 2001 From: LuQQiu Date: Thu, 8 May 2025 13:09:11 -0700 Subject: [PATCH] chore: add default for result structs (#2377) add default for result structs, when values are not provided, will go with the default values ## Summary by CodeRabbit - **Chores** - Improved internal handling of table operation results to support default values. No changes to user-facing features or functionality. --- rust/lancedb/src/table.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/rust/lancedb/src/table.rs b/rust/lancedb/src/table.rs index f18fad6c..9ef7a190 100644 --- a/rust/lancedb/src/table.rs +++ b/rust/lancedb/src/table.rs @@ -423,7 +423,7 @@ pub trait Tags: Send + Sync { async fn update(&mut self, tag: &str, version: u64) -> Result<()>; } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] pub struct UpdateResult { #[serde(default)] pub rows_updated: u64, @@ -434,7 +434,7 @@ pub struct UpdateResult { pub version: u64, } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] pub struct AddResult { // The commit version associated with the operation. // A version of `0` indicates compatibility with legacy servers that do not return @@ -443,7 +443,7 @@ pub struct AddResult { pub version: u64, } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] pub struct DeleteResult { // The commit version associated with the operation. // A version of `0` indicates compatibility with legacy servers that do not return @@ -452,7 +452,7 @@ pub struct DeleteResult { pub version: u64, } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] pub struct MergeResult { // The commit version associated with the operation. // A version of `0` indicates compatibility with legacy servers that do not return @@ -472,7 +472,7 @@ pub struct MergeResult { pub num_deleted_rows: u64, } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] pub struct AddColumnsResult { // The commit version associated with the operation. // A version of `0` indicates compatibility with legacy servers that do not return @@ -481,7 +481,7 @@ pub struct AddColumnsResult { pub version: u64, } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] pub struct AlterColumnsResult { // The commit version associated with the operation. // A version of `0` indicates compatibility with legacy servers that do not return @@ -490,7 +490,7 @@ pub struct AlterColumnsResult { pub version: u64, } -#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] pub struct DropColumnsResult { // The commit version associated with the operation. // A version of `0` indicates compatibility with legacy servers that do not return