async fn table_metadata(req: Request<AppState<'_>>) -> Result<tide::Response, tide::Error> {
    use crate::models::Table;

    let named_share = req.param("share")?;
    let named_schema = req.param("schema")?;
    let named_table = req.param("table")?;
    let tokened = req.ext::<Tokened>().unwrap();
    // TODO 404

    let db = &req.state().db;
    let mut table = Table::find(&named_share, &named_schema, &named_table, &tokened.id, db).await?;
    table.load_delta().await?;

    let metadata = json!({"metaData" : table.metadata()?});
    let protocol = json!({"protocol" : table.protocol()?});

    return Ok(tide::Response::builder(200)
        .header("Delta-Table-Version", table.delta_version()?)
        // Really gross hacking the "streaming JSON" into place
        .body(format!("{}\n{}", protocol, metadata))
        .build());
    //Ok(tide::Response::builder(404).build())
}
/**
 * GET /shares/{share}/schemas/{schema}/tables/{table}/metadata
 * operationId: GetTableMetadata
 *
 * The response from this API is "streaming JSON" which is kind of annoying
 * and unnecessary, so this function just creates a big string from the two (laffo)
 * lines of content that the client is expecting.
 */


The response from this API is "streaming JSON" which is kind of annoying
and unnecessary, so this function just creates a big string from the two (laffo)
lines of content that the client is expecting.
The response from this API is " streaming JSON " which is kind of annoying and unnecessary so this function just creates a big string from the two ( laffo ) lines of content that the client is expecting .
async fn table_metadata(req: Request<AppState<'_>>) -> Result<tide::Response, tide::Error> {
    use crate::models::Table;
    let named_share = req.param("share")?;
    let named_schema = req.param("schema")?;
    let named_table = req.param("table")?;
    let tokened = req.ext::<Tokened>().unwrap();
    // TODO 404
    let db = &req.state().db;
    let mut table = Table::find(&named_share, &named_schema, &named_table, &tokened.id, db).await?;
    table.load_delta().await?;
    let metadata = json!({"metaData" : table.metadata()?});
    let protocol = json!({"protocol" : table.protocol()?});
    return Ok(tide::Response::builder(200)
        .header("Delta-Table-Version", table.delta_version()?)
        // Really gross hacking the "streaming JSON" into place
        .body(format!("{}\n{}", protocol, metadata))
        .build());
    //Ok(tide::Response::builder(404).build())
}
async fn table_metadata ( req : Request < AppState < ' _ > > ) -> Result < tide :: Response , tide :: Error > { use crate :: models :: Table ; let named_share = req . param ( " " ) ? ; let named_schema = req . param ( " " ) ? ; let named_table = req . param ( " " ) ? ; let tokened = req . ext :: < Tokened > ( ) . unwrap ( ) ; // TODO 404 let db = & req . state ( ) . db ; let mut table = Table :: find ( & named_share , & named_schema , & named_table , & tokened . id , db ) . await ? ; table . load_delta ( ) . await ? ; let metadata = json ! ( { " " table metadata ( ) } ) ; let protocol = json ! ( { " " table protocol ( ) } ) ; return Ok ( tide :: Response :: builder ( 200 ) . header ( " " , table . delta_version ( ) ? ) // Really gross hacking the "streaming JSON" into place . body ( format ! ( " \n " protocol metadata ) ) . build ( ) ) ; //Ok(tide::Response::builder(404).build()) }
GET /shares/{share}/schemas/{schema}/tables/{table}/metadata
 operationId: GetTableMetadata
GET / shares / { share } / schemas / { schema } / tables / { table } / metadata operationId : GetTableMetadata
req
Request<AppState<'_>>
req
Request<AppState<'_>>