commands.go 554 B

123456789101112131415161718192021222324252627
  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. }