-
Notifications
You must be signed in to change notification settings - Fork 132
/
ddl.go
51 lines (48 loc) · 1.74 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
package kafka
// See: debezium/debezium-core/src/main/java/io/debezium/relational/history
type DDLSource struct {
Server string `json:"server"`
}
type DDLPosition struct {
// See dbz `offsetUsingPosition`.
TsSec int64 `json:"ts_sec"`
File string `json:"file"`
Pos int64 `json:"pos"`
Gtids string `json:"gtids"`
Snapshot bool `json:"snapshot,omitempty"`
}
type DDLTableChange struct {
// create/alter/drop
Type string `json:"type"`
ID string `json:"id"`
Table struct {
DefaultCharsetName string `json:"defaultCharsetName"`
PrimaryKeyColumnNames []string `json:"primaryKeyColumnNames"`
Columns []struct {
// See dbz `JsonTableChangeSerializer.toDocument(Column column)`.
Name string `json:"name"`
JdbcType int `json:"jdbcType"`
NativeType *int `json:"nativeType,omitempty"`
TypeName string `json:"typeName"`
TypeExpression string `json:"typeExpression"`
CharsetName *string `json:"charsetName"`
Length *int `json:"length,omitempty"`
Scale *int `json:"scale,omitempty"`
Position int `json:"position"`
Optional bool `json:"optional"`
AutoIncremented bool `json:"autoIncremented"`
Generated bool `json:"generated"`
} `json:"columns"`
} `json:"table"`
Comment string `json:"comment"`
}
type DDLPayload struct {
// See dbz `class HistoryRecord`.
Source DDLSource `json:"source,omitempty"`
Position DDLPosition `json:"position,omitempty"`
DatabaseName string `json:"databaseName,omitempty"`
// unused for MySQL
SchemaName string `json:"schemaName,omitempty"`
DDL string `json:"ddl"`
TableChanges []DDLTableChange `json:"tableChanges"`
}