simplified appendBinlogEntry()

This commit is contained in:
Shlomi Noach 2016-03-24 14:52:49 +01:00
parent 8aa6a9750c
commit fb04eb232f

View File

@ -160,11 +160,15 @@ func parseEntries(scanner *bufio.Scanner) (entries [](*BinlogEntry), err error)
var endLogPos uint64 var endLogPos uint64
appendBinlogEntry := func() { appendBinlogEntry := func() {
if binlogEntry.StatementType != "" { if binlogEntry.LogPos == 0 {
entries = append(entries, binlogEntry) return
log.Debugf("entry: %+v", *binlogEntry)
//fmt.Println(fmt.Sprintf("%s `%s`.`%s`", binlogEntry.StatementType, binlogEntry.DatabaseName, binlogEntry.TableName))
} }
if binlogEntry.StatementType == "" {
return
}
entries = append(entries, binlogEntry)
log.Debugf("entry: %+v", *binlogEntry)
fmt.Println(fmt.Sprintf("%s `%s`.`%s`", binlogEntry.StatementType, binlogEntry.DatabaseName, binlogEntry.TableName))
} }
for scanner.Scan() { for scanner.Scan() {
switch state { switch state {
@ -194,8 +198,6 @@ func parseEntries(scanner *bufio.Scanner) (entries [](*BinlogEntry), err error)
return entries, log.Errore(err) return entries, log.Errore(err)
} }
} }
if binlogEntry.LogPos != 0 { appendBinlogEntry()
appendBinlogEntry()
}
return entries, err return entries, err
} }