linkrs_query/binder/bound/
stmt_ddl.rs1use crate::parser::ast::fulltext::{IndexFieldDef, IndexOptions};
2use crate::parser::ast::vector::VectorIndexConfig;
3use crate::parser::ast::{
4 AlterTarget, DescTarget, DropTarget, ExplainFormat, ShowCreateTarget, ShowTarget,
5};
6
7use linkrs_core::types::semantic::{ColumnDef, ValueType};
8use linkrs_core::types::FulltextEngineType;
9
10use super::stmt::BoundStatement;
11
12#[derive(Debug, Clone)]
13pub struct BoundDrop {
14 pub target: DropTarget,
15 pub if_exists: bool,
16}
17
18#[derive(Debug, Clone)]
19pub struct BoundAlter {
20 pub target: AlterTarget,
21}
22
23#[derive(Debug, Clone)]
24pub struct BoundShow {
25 pub target: ShowTarget,
26}
27
28#[derive(Debug, Clone)]
29pub struct BoundShowCreate {
30 pub target: ShowCreateTarget,
31}
32
33#[derive(Debug, Clone)]
34pub struct BoundDesc {
35 pub target: DescTarget,
36}
37
38#[derive(Debug, Clone)]
39pub struct BoundClearSpace {
40 pub space_name: String,
41}
42
43#[derive(Debug, Clone)]
44pub struct BoundCreateUser {
45 pub username: String,
46 pub password: String,
47 pub if_not_exists: bool,
48}
49
50#[derive(Debug, Clone)]
51pub struct BoundDropUser {
52 pub username: String,
53 pub if_exists: bool,
54}
55
56#[derive(Debug, Clone)]
57pub struct BoundAlterUser {
58 pub username: String,
59 pub password: Option<String>,
60 pub is_locked: Option<bool>,
61}
62
63#[derive(Debug, Clone)]
64pub struct BoundCreateFulltextIndex {
65 pub index_name: String,
66 pub schema_name: String,
67 pub fields: Vec<IndexFieldDef>,
68 pub engine_type: FulltextEngineType,
69 pub options: IndexOptions,
70 pub if_not_exists: bool,
71}
72
73#[derive(Debug, Clone)]
74pub struct BoundCreateVectorIndex {
75 pub index_name: String,
76 pub schema_name: String,
77 pub field_name: String,
78 pub config: VectorIndexConfig,
79 pub if_not_exists: bool,
80}
81
82#[derive(Debug, Clone)]
83pub struct BoundExplain {
84 pub statement: Box<BoundStatement>,
85 pub format: ExplainFormat,
86 pub analyze: bool,
87}
88
89#[derive(Debug, Clone)]
90pub struct BoundProfile {
91 pub statement: Box<BoundStatement>,
92 pub format: ExplainFormat,
93}
94
95#[derive(Debug, Clone)]
96pub struct BoundBeginTransaction {
97 pub read_only: Option<bool>,
98}
99
100#[derive(Debug, Clone)]
101pub struct BoundCommit;
102
103#[derive(Debug, Clone)]
104pub struct BoundRollback {
105 pub savepoint_name: Option<String>,
106}
107
108#[derive(Debug, Clone)]
109pub struct BoundSavepoint {
110 pub name: String,
111}
112
113#[derive(Debug, Clone)]
114pub struct BoundReleaseSavepoint {
115 pub name: String,
116}
117
118#[derive(Debug, Clone)]
124pub struct BoundAssignmentStatement {
125 pub variable: String,
126 pub statement: Box<BoundStatement>,
127}
128
129#[derive(Debug, Clone)]
130pub struct BoundUse {
131 pub space: String,
132}
133
134#[derive(Debug, Clone)]
138pub struct BoundColumnDef {
139 pub name: String,
140 pub type_: ValueType,
141}
142
143impl From<ColumnDef> for BoundColumnDef {
144 fn from(c: ColumnDef) -> Self {
145 Self {
146 name: c.name,
147 type_: c.type_,
148 }
149 }
150}