Skip to content

Commit

Permalink
chore: make rows read and written optional
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelFreeze committed Oct 20, 2023
1 parent ed25636 commit 26fab01
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/d1/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ pub type Result<T = ()> = std::result::Result<T, DatabaseError>;
/// The metadata of a D1 database execution.
#[derive(Deserialize)]
pub struct D1ResultMetadata {
#[serde(default)]
duration: u64,
rows_read: Option<u64>,
rows_written: Option<u64>,

#[serde(default)]
rows_read: u64,

#[serde(default)]
rows_written: u64,
}

impl D1ResultMetadata {
Expand All @@ -19,12 +24,12 @@ impl D1ResultMetadata {
}

/// Returns the number of rows read (scanned) by this query
pub fn rows_read(&self) -> Option<u64> {
pub fn rows_read(&self) -> u64 {
self.rows_read
}

/// Returns the number of rows written by this query
pub fn rows_written(&self) -> Option<u64> {
pub fn rows_written(&self) -> u64 {
self.rows_written
}
}
Expand Down

0 comments on commit 26fab01

Please sign in to comment.