use serde::{Deserialize, Serialize};
use super::{Condition, Value};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct InsertStatement {
pub table: String,
pub columns: Vec<String>,
pub rows: Vec<Vec<Value>>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct UpdateAssignment {
pub column: String,
pub value: Value,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct UpdateStatement {
pub table: String,
pub assignments: Vec<UpdateAssignment>,
pub where_clause: Option<Condition>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct InsertEdgeStatement {
pub collection: String,
pub edge_id: Option<u64>,
pub source: u64,
pub target: u64,
pub label: String,
pub properties: Vec<(String, Value)>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeleteStatement {
pub table: String,
pub where_clause: Condition,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct DeleteEdgeStatement {
pub collection: String,
pub edge_id: u64,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SelectEdgesStatement {
pub collection: String,
pub where_clause: Option<Condition>,
pub limit: Option<u64>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct InsertNodeStatement {
pub collection: String,
pub node_id: u64,
pub payload: serde_json::Value,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[non_exhaustive]
pub enum DmlStatement {
Insert(InsertStatement),
Upsert(InsertStatement),
Update(UpdateStatement),
InsertEdge(InsertEdgeStatement),
Delete(DeleteStatement),
DeleteEdge(DeleteEdgeStatement),
SelectEdges(SelectEdgesStatement),
InsertNode(InsertNodeStatement),
}