expr.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package canal
  2. import (
  3. "io"
  4. "github.com/pingcap/parser/ast"
  5. "github.com/pingcap/parser/format"
  6. )
  7. func init() {
  8. ast.NewValueExpr = newValueExpr
  9. ast.NewParamMarkerExpr = newParamExpr
  10. ast.NewDecimal = func(_ string) (interface{}, error) {
  11. return nil, nil
  12. }
  13. ast.NewHexLiteral = func(_ string) (interface{}, error) {
  14. return nil, nil
  15. }
  16. ast.NewBitLiteral = func(_ string) (interface{}, error) {
  17. return nil, nil
  18. }
  19. }
  20. type paramExpr struct {
  21. valueExpr
  22. }
  23. func newParamExpr(_ int) ast.ParamMarkerExpr {
  24. return &paramExpr{}
  25. }
  26. func (pe *paramExpr) SetOrder(o int) {}
  27. type valueExpr struct {
  28. ast.TexprNode
  29. }
  30. func newValueExpr(_ interface{}, _ string, _ string) ast.ValueExpr { return &valueExpr{} }
  31. func (ve *valueExpr) SetValue(val interface{}) {}
  32. func (ve *valueExpr) GetValue() interface{} { return nil }
  33. func (ve *valueExpr) GetDatumString() string { return "" }
  34. func (ve *valueExpr) GetString() string { return "" }
  35. func (ve *valueExpr) GetProjectionOffset() int { return 0 }
  36. func (ve *valueExpr) SetProjectionOffset(offset int) {}
  37. func (ve *valueExpr) Restore(ctx *format.RestoreCtx) error { return nil }
  38. func (ve *valueExpr) Accept(v ast.Visitor) (node ast.Node, ok bool) { return }
  39. func (ve *valueExpr) Text() string { return "" }
  40. func (ve *valueExpr) SetText(text string) {}
  41. func (ve *valueExpr) Format(w io.Writer) {}