/
utils.go
50 lines (43 loc) · 933 Bytes
/
utils.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
package input
import (
"github.com/go-mysql-org/go-mysql/schema"
schema2 "github.com/liuxinwang/go-mysql-starrocks/pkg/schema"
)
type inputContext struct {
BinlogName string `toml:"binlog-name"`
BinlogPos uint32 `toml:"binlog-pos"`
BinlogGTID string `toml:"binlog-gtid"`
force bool
}
func deserialize(raw interface{}, column schema.TableColumn) interface{} {
if raw == nil {
return nil
}
ret := raw
if column.RawType == "text" || column.RawType == "json" {
_, ok := raw.([]uint8)
if ok {
ret = string(raw.([]uint8))
}
}
return ret
}
func deserializeForLocal(raw interface{}, column schema2.TableColumn) interface{} {
if raw == nil {
return nil
}
ret := raw
if column.RawType == "text" || column.RawType == "json" {
_, ok := raw.([]uint8)
if ok {
ret = string(raw.([]uint8))
}
}
return ret
}
type node struct {
db string
table string
newDb string
newTable string
}