gluesql icon indicating copy to clipboard operation
gluesql copied to clipboard

Return Vec<Table> when executing select query

Open CEOJINSUNG opened this issue 2 years ago • 1 comments

Description

When we use gluesql, there should be work progress converting values into tables. For instance, orm changes value into specific table when selecting values.

So, I gonna make value-table mapping function in Payload enum. So if there is some good references, please reply to me

use serde::Deserialize;
use glue::execute;

#[derive(Deserialize)]
struct User {
    pub id: i32,
}

fn main() {
    let value = Payload::Select {
      labels: ["id"],
      values: [[1]]
    }

    let users: Vec<User> = execute(value)
    assert_eq!(users, vec![
        User { id: 1 }
    ])
}

Reference

  • https://github.com/BurntSushi/rust-csv

CEOJINSUNG avatar Jun 10 '23 06:06 CEOJINSUNG

This should meet your expectation: #1452

JakkuSakura avatar Jan 23 '24 12:01 JakkuSakura