Move Column into schema.rs
This commit is contained in:
parent
0ec02eeef8
commit
a2180a3e32
9 changed files with 23 additions and 24 deletions
|
|
@ -1,7 +1,7 @@
|
|||
use async_trait::async_trait;
|
||||
use minisql::restricted_row::RestrictedRow;
|
||||
use minisql::schema::TableSchema;
|
||||
use minisql::type_system::{Value};
|
||||
use minisql::schema::{Column, TableSchema};
|
||||
use minisql::type_system::Value;
|
||||
use proto::message::backend::{BackendMessage, ColumnDescription, CommandCompleteData, DataRowData, ErrorResponseData, ReadyForQueryData, RowDescriptionData};
|
||||
use proto::message::primitive::pglist::PgList;
|
||||
use proto::writer::backend::BackendProtoWriter;
|
||||
|
|
@ -58,7 +58,7 @@ impl<W> ServerProto for W where W: BackendProtoWriter + Send {
|
|||
|
||||
async fn write_table_header(&mut self, table_schema: &TableSchema, row: &RestrictedRow) -> anyhow::Result<()> {
|
||||
let columns = row.iter()
|
||||
.map(|(index, value)| value_to_column_description(table_schema, value, *index))
|
||||
.map(|(column, value)| value_to_column_description(table_schema, value, *column))
|
||||
.collect::<anyhow::Result<Vec<ColumnDescription>>>()?;
|
||||
|
||||
self.write_proto(RowDescriptionData { columns: columns.into() }.into()).await?;
|
||||
|
|
@ -84,7 +84,7 @@ impl<W> ServerProto for W where W: BackendProtoWriter + Send {
|
|||
}
|
||||
}
|
||||
|
||||
fn value_to_column_description(schema: &TableSchema, value: &Value, index: usize) -> anyhow::Result<ColumnDescription> {
|
||||
fn value_to_column_description(schema: &TableSchema, value: &Value, index: Column) -> anyhow::Result<ColumnDescription> {
|
||||
let name = schema.column_name_from_column(index);
|
||||
|
||||
let table_oid = schema.table_name().as_bytes().as_ptr() as i32;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue