binlog.go 547 B

1234567891011121314151617181920212223242526272829303132
  1. package binlog
  2. import "fmt"
  3. func (c *Conn) startBinLogStream() error {
  4. bldc := &BinLogDumpCommand{
  5. Status: COMMAND_BIN_LOG_DUMP,
  6. Position: 120,
  7. Flags: BINLOG_DUMP_NON_BLOCK,
  8. ServerId: c.Config.ServerId,
  9. Filename: c.Config.BinLogFile,
  10. }
  11. return c.writeBinLogDumpCommand(bldc)
  12. }
  13. func (c *Conn) listenForBinlog() error {
  14. _, err := c.listen()
  15. if err != nil {
  16. return err
  17. }
  18. //fmt.Printf("res = %+v\n", res)
  19. fmt.Println("hello")
  20. err = c.listenForBinlog()
  21. fmt.Println("test")
  22. if err != nil {
  23. return err
  24. }
  25. return nil
  26. }