1
0

commands.go 553 B

1234567891011121314151617181920212223242526
  1. package binlog
  2. const COMMAND_BIN_LOG_DUMP = 0x12
  3. const BINLOG_DUMP_NON_BLOCK = 0x01
  4. type BinLogDumpCommand struct {
  5. Status uint64
  6. Position uint64
  7. Flags uint64
  8. ServerId uint64
  9. Filename string
  10. }
  11. func (c *Conn) writeBinLogDumpCommand(bldc *BinLogDumpCommand) error {
  12. c.putInt(TypeFixedInt, bldc.Status, 1)
  13. c.putInt(TypeFixedInt, bldc.Position, 4)
  14. c.putInt(TypeFixedInt, bldc.Flags, 2)
  15. c.putInt(TypeFixedInt, bldc.ServerId, 4)
  16. c.putString(TypeRestOfPacketString, bldc.Filename)
  17. if c.Flush() != nil {
  18. return c.Flush()
  19. }
  20. return nil
  21. }