Skip to content

Commit

Permalink
response: Add FromResponse for multi-row responses
Browse files Browse the repository at this point in the history
  • Loading branch information
ohsayan committed Jun 23, 2024
1 parent c171681 commit 6148487
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 11 deletions.
30 changes: 20 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,54 +2,64 @@

All changes in this project will be noted in this file.

### 0.8.7 (unreleased)
## 0.8.8

### Fixes

- Fixed response decoder and handling issues

### Additions

- Added `FromResponse` for `Vec<Row>`

## 0.8.7

> - **Field change warnings**:
> - The `Config` struct now has one additional field. This is not a breaking change because the functionality of the library remains unchanged
#### Additions
### Additions

- Added support for pipelines
- Added `Response::parse` to convert a response into compatible types

### 0.8.6
## 0.8.6

Reduced allocations in `Query`.

### 0.8.5
## 0.8.5

Fixed bugs with the derive macros.

### 0.8.4
## 0.8.4

> **Yanked version**
Fixed an issue with single-item struct derives when using the `Response` macro.

### 0.8.3
## 0.8.3

Added the following implementations:
- `FromResponse` for `Row`
- `FromValue` for `Value` (this was erroneously missing)
- Added the `Value::parse` and `Value::parse_cloned` member methods
- Added `Row::into_first` and `Row::into_first_as` member methods

### 0.8.2
## 0.8.2

Support deriving queries and responses.

### 0.8.1
## 0.8.1

Fixed issues with documentation

## 0.8.0

#### New features
### New features
- Completely up to date for Skyhash 2.0
- New query API interface for Skytable Octave (completely breaking!)
- No longer depends on OpenSSL

#### Breaking changes
### Breaking changes
The enter query interface as changed and is incompatible with previous driver versions. Please consider reading the Skytable
Octave upgrade guide.

Expand Down
2 changes: 1 addition & 1 deletion src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,6 @@ fn decode_multi_value_stream() {
Value::String("fghij".to_string())
])
])
.collect::<Vec<Vec<Value>>>()
.collect::<Vec<_>>()
);
}
9 changes: 9 additions & 0 deletions src/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,3 +314,12 @@ impl FromResponse for Row {
}
}
}

impl FromResponse for Vec<Row> {
fn from_response(resp: Response) -> ClientResult<Self> {
match resp {
Response::Rows(rows) => Ok(rows),
_ => Err(Error::ParseError(ParseError::ResponseMismatch)),
}
}
}

0 comments on commit 6148487

Please sign in to comment.