func (this *BinlogCoordinates) PreviousFileCoordinatesBy(offset int) (BinlogCoordinates, error) {
	result := BinlogCoordinates{LogPos: 0, Type: this.Type}

	fileNum, numLen := this.FileNumber()
	if fileNum == 0 {
		return result, errors.New("Log file number is zero, cannot detect previous file")
	}
	newNumStr := fmt.Sprintf("%d", (fileNum - offset))
	newNumStr = strings.Repeat("0", numLen-len(newNumStr)) + newNumStr

	tokens := strings.Split(this.LogFile, ".")
	tokens[len(tokens)-1] = newNumStr
	result.LogFile = strings.Join(tokens, ".")
	return result, nil
}
// PreviousFileCoordinatesBy guesses the filename of the previous binlog/relaylog, by given offset (number of files back)
PreviousFileCoordinatesBy guesses the filename of the previous binlog/relaylog, by given offset (number of files back)
// PreviousFileCoordinatesBy guesses the filename of the previous binlog / relaylog by given offset ( number of files back )
func (this *BinlogCoordinates) PreviousFileCoordinatesBy(offset int) (BinlogCoordinates, error) {
	result := BinlogCoordinates{LogPos: 0, Type: this.Type}
	fileNum, numLen := this.FileNumber()
	if fileNum == 0 {
		return result, errors.New("Log file number is zero, cannot detect previous file")
	}
	newNumStr := fmt.Sprintf("%d", (fileNum - offset))
	newNumStr = strings.Repeat("0", numLen-len(newNumStr)) + newNumStr
	tokens := strings.Split(this.LogFile, ".")
	tokens[len(tokens)-1] = newNumStr
	result.LogFile = strings.Join(tokens, ".")
	return result, nil
}
func ( this * BinlogCoordinates ) PreviousFileCoordinatesBy ( offset int ) ( BinlogCoordinates , error ) { result := BinlogCoordinates { LogPos : 0 , Type : this . Type } fileNum , numLen := this . FileNumber ( ) if fileNum == 0 { return result , errors . New ( " " ) } newNumStr := fmt . Sprintf ( " " , ( fileNum - offset ) ) newNumStr = strings . Repeat ( " " , numLen - len ( newNumStr ) ) + newNumStr tokens := strings . Split ( this . LogFile , " " ) tokens [ len ( tokens ) - 1 ] = newNumStr result . LogFile = strings . Join ( tokens , " " ) return result , nil }
PreviousFileCoordinatesBy guesses the filename of the previous binlog/relaylog, by given offset (number of files back)
PreviousFileCoordinatesBy guesses the filename of the previous binlog / relaylog by given offset ( number of files back )