Skip to content

Commit 10ba8bc

Browse files
committed
feat(key-aux): respond with aux key info in key requests
1 parent 967148f commit 10ba8bc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/service/flows.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub struct GetKeysParam {
6161
#[derive(Serialize)]
6262
pub struct GetKeysResponse {
6363
key_type: schema::EnrichedValueType,
64-
keys: Vec<value::KeyValue>,
64+
keys: Vec<(value::KeyValue, serde_json::Value)>,
6565
}
6666

6767
pub async fn get_keys(
@@ -110,7 +110,7 @@ pub async fn get_keys(
110110
});
111111
let mut keys = Vec::new();
112112
while let Some(rows) = rows_stream.next().await {
113-
keys.extend(rows?.into_iter().map(|row| row.key));
113+
keys.extend(rows?.into_iter().map(|row| (row.key, row.key_aux_info)));
114114
}
115115
Ok(Json(GetKeysResponse {
116116
key_type: key_type.clone(),
@@ -122,7 +122,7 @@ pub async fn get_keys(
122122
pub struct SourceRowKeyParams {
123123
field: String,
124124
key: Vec<String>,
125-
key_aux: Option<serde_json::Value>,
125+
key_aux: Option<String>,
126126
}
127127

128128
#[derive(Serialize)]
@@ -165,7 +165,11 @@ impl<'a> SourceRowKeyContextHolder<'a> {
165165
.key_field()
166166
.ok_or_else(|| api_error!("field {} does not have a key", source_row_key.field))?;
167167
let key = value::KeyValue::from_strs(source_row_key.key, &key_field.value_type.typ)?;
168-
let key_aux_info = source_row_key.key_aux.unwrap_or_default();
168+
let key_aux_info = source_row_key
169+
.key_aux
170+
.map(|s| serde_json::from_str(&s))
171+
.transpose()?
172+
.unwrap_or_default();
169173
Ok(Self {
170174
plan,
171175
import_op_idx,

0 commit comments

Comments
 (0)