Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fmt
Browse files Browse the repository at this point in the history
nyurik committed Aug 8, 2022
1 parent c8ea317 commit 5d14e92
Showing 1 changed file with 19 additions and 21 deletions.
40 changes: 19 additions & 21 deletions src/function_source.rs
Original file line number Diff line number Diff line change
@@ -105,19 +105,17 @@ impl Source for FunctionSource {
conn.query_one(&prep_query, &[&xyz.z, &xyz.x, &xyz.y])
};

let tile = tile
.map(|row| row.get("tile"))
.map_err(|error| {
prettify_error!(
error,
r#"Can't get "{}" tile at /{}/{}/{} with {:?} params"#,
self.id,
xyz.z,
xyz.x,
xyz.z,
query_to_json(query)
)
})?;
let tile = tile.map(|row| row.get("tile")).map_err(|error| {
prettify_error!(
error,
r#"Can't get "{}" tile at /{}/{}/{} with {:?} params"#,
self.id,
xyz.z,
xyz.x,
xyz.z,
query_to_json(query)
)
})?;

Ok(tile)
}
@@ -140,7 +138,8 @@ pub fn get_function_sources(conn: &mut Connection) -> Result<FunctionSources, io

info!("Found {id} function source");

let (query, has_q_param) = create_func_query(&schema, &function, &params, &output_type, &output_names);
let (query, has_q_param) =
create_func_query(&schema, &function, &params, &output_type, &output_names);
let source = FunctionSource {
id: id.clone(),
schema,
@@ -206,14 +205,13 @@ fn create_func_query(

if output_type.is_array() {
match output_names {
Value::Array(output_names) => {
match output_names.get(0) {
Some(Value::String(name)) => {
let name = escape_identifier(name);
sql = format!("({sql}).{name}");},
_ => unreachable!("output_names[0] is not a string"),
Value::Array(output_names) => match output_names.get(0) {
Some(Value::String(name)) => {
let name = escape_identifier(name);
sql = format!("({sql}).{name}");
}
}
_ => unreachable!("output_names[0] is not a string"),
},
_ => unreachable!("output_names is not an array"),
}
}

0 comments on commit 5d14e92

Please sign in to comment.