-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathddl.go
140 lines (113 loc) · 2.72 KB
/
ddl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
package ast
import (
"github.com/sjjian/oracle-sql-parser/ast/element"
)
/*
Alter Table Statement
see: https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/ALTER-TABLE.html#GUID-552E7373-BF93-477D-9DA3-B2C9386F2877
*/
type AlterTableStmt struct {
node
TableName *TableName
AlterTableClauses []AlterTableClause
}
type AlterTableClause interface {
IsAlterTableClause()
}
type alterTableClause struct{}
func (c *alterTableClause) IsAlterTableClause() {}
type AddColumnClause struct {
alterTableClause
Columns []*ColumnDef
}
type ModifyColumnClause struct {
alterTableClause
Columns []*ColumnDef
}
type DropColumnClause struct {
alterTableClause
Type DropColumnType
Columns []*element.Identifier
Props []DropColumnProp
CheckPoint *int
}
type RenameColumnClause struct {
alterTableClause
OldName *element.Identifier
NewName *element.Identifier
}
type AddConstraintClause struct {
alterTableClause
Constraints []*OutOfLineConstraint
}
type ModifyConstraintClause struct {
alterTableClause
Constraint *OutOfLineConstraint
}
type RenameConstraintClause struct {
alterTableClause
OldName *element.Identifier
NewName *element.Identifier
}
type DropConstraintClause struct {
alterTableClause
Constraint *OutOfLineConstraint
}
/*
Create Table Statement
see: https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/CREATE-TABLE.html#GUID-F9CE0CC3-13AE-4744-A43C-EAC7A71AAAB6
*/
type CreateTableStmt struct {
node
TableName *TableName
RelTable *RelTableDef
}
type RelTableDef struct {
TableStructs []TableStructDef
}
type TableStructDef interface {
IsTableStructDef()
}
type tableStructDef struct{}
func (c *tableStructDef) IsTableStructDef() {}
type ColumnDef struct {
tableStructDef
ColumnName *element.Identifier
Datatype element.Datatype
Collation *Collation
Props []ColumnProp
Default *ColumnDefault
Constraints []*InlineConstraint
}
type InlineConstraint struct {
Name *element.Identifier
Type ConstraintType
}
type OutOfLineConstraint struct {
tableStructDef
InlineConstraint
Columns []*element.Identifier
}
/*
Create Index Statement
see: https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/CREATE-INDEX.html#GUID-1F89BBC0-825F-4215-AF71-7588E31D8BFE
*/
type CreateIndexStmt struct {
node
}
/*
Drop Table Statement
see: https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/CREATE-INDEX.html#GUID-1F89BBC0-825F-4215-AF71-7588E31D8BFE
*/
type DropTableStmt struct {
node
TableName *TableName
}
/*
Drop Index Statement
see: https://docs.oracle.com/en/database/oracle/oracle-database/21/sqlrf/DROP-INDEX.html#GUID-F60F75DF-2866-4F93-BB7F-8FCE64BF67B6
*/
type DropIndexStmt struct {
node
IndexName *IndexName
}