mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 17:14:20 +01:00
27 lines
565 B
Rust
27 lines
565 B
Rust
use std::fmt::Display;
|
|
|
|
use itertools::Itertools;
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use crate::model::table::Table;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Create {
|
|
pub table: Table,
|
|
}
|
|
|
|
impl Display for Create {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "CREATE TABLE {} (", self.table.name)?;
|
|
|
|
let cols = self
|
|
.table
|
|
.columns
|
|
.iter()
|
|
.map(|column| column.to_string())
|
|
.join(", ");
|
|
|
|
write!(f, "{cols})")
|
|
}
|
|
}
|