func BuildValues(event *replication.RowsEvent) [][]string {
	var values [][]string
	for _, row := range event.Rows {
		var columns []string
		for i, t := range event.Table.ColumnType {
			if row[i] == nil {
				columns = append(columns, "NULL")
				continue
			}
			switch t {
			case mysql.MYSQL_TYPE_DECIMAL, mysql.MYSQL_TYPE_NEWDECIMAL, mysql.MYSQL_TYPE_TINY, mysql.MYSQL_TYPE_SHORT,
				mysql.MYSQL_TYPE_LONG, mysql.MYSQL_TYPE_FLOAT, mysql.MYSQL_TYPE_DOUBLE, mysql.MYSQL_TYPE_NULL,
				mysql.MYSQL_TYPE_TIMESTAMP, mysql.MYSQL_TYPE_LONGLONG, mysql.MYSQL_TYPE_INT24:
				columns = append(columns, fmt.Sprint(row[i]))
			case mysql.MYSQL_TYPE_DATE, mysql.MYSQL_TYPE_TIME, mysql.MYSQL_TYPE_DATETIME, mysql.MYSQL_TYPE_YEAR,
				mysql.MYSQL_TYPE_NEWDATE, mysql.MYSQL_TYPE_TIMESTAMP2, mysql.MYSQL_TYPE_DATETIME2, mysql.MYSQL_TYPE_TIME2:
				columns = append(columns, fmt.Sprint("'", row[i], "'"))
			case mysql.MYSQL_TYPE_VARCHAR, mysql.MYSQL_TYPE_VAR_STRING, mysql.MYSQL_TYPE_STRING:
				switch row[i].(type) {
				case string:
					if common.Config.Global.HexString {
						columns = append(columns, fmt.Sprintf(`X'%s'`, hex.EncodeToString(row[i].([]byte))))
					} else {
						columns = append(columns, fmt.Sprintf(`"%s"`, escape(row[i].(string))))
					}
				case int, int64, int32, int16, int8, uint64, uint32, uint16, uint8:
					columns = append(columns, fmt.Sprint(row[i]))
				default:
					columns = append(columns, fmt.Sprintf(`'%s'`, fmt.Sprint(row[i])))
				}
			case mysql.MYSQL_TYPE_JSON:
				columns = append(columns, fmt.Sprintf(`'%s'`, row[i].([]byte)))
			case mysql.MYSQL_TYPE_BIT:
				columns = append(columns, fmt.Sprintf(`%d`, row[i].(int64)))
			default:
				columns = append(columns, fmt.Sprintf(`X'%s'`, hex.EncodeToString(row[i].([]byte))))
			}
		}
		values = append(values, columns)
	}
	return values
}
BuildValues build values list
package rebuild
import (
	"encoding/hex"
	"encoding/json"
	"fmt"
	"github.com/LianjiaTech/lightning/common"
	"github.com/BixData/gluabit32"
	"github.com/BixData/gluasocket"
	"github.com/montanaflynn/stats"
	"github.com/satori/go.uuid"
	"github.com/siddontang/go-mysql/mysql"
	"github.com/siddontang/go-mysql/replication"
	"github.com/yuin/gopher-lua"
	"github.com/zhu327/gluadb"
	"layeh.com/gopher-lfs"
)
var TableStats map[string]map[string]int64
var QueryStats map[string]int64
var TransactionStartPos float64
var TransactionStartTimeStamp float64
var MaxTransactionTime float64
var MaxTransactionSize float64
var MaxTransactionSizeStartPos float64
var MaxTransactionTimeStartPos float64
var MaxTransactionTimeStopPos float64
var TransactionSizeStats []float64
var TransactionTimeStats []float64
type Stats struct {
	Table           map[string]map[string]int64  `json:"TableStats"`
	Query           map[string]int64             `json:"QueryStats"`
	Transaction     map[string]map[string]string `json:"TransactionStats"`
	TransactionSize []float64                    `json:"-"`  
	TransactionTime []float64                    `json:"-"`  
}
var BinlogStats Stats
var Lua *lua.LState
var InsertValuesMerge []string
func init() {
	TableStats = make(map[string]map[string]int64)
}
func RowEventTable(event *replication.BinlogEvent) string {
	if event == nil {
		return ""
	}
	switch event.Header.EventType {
	case replication.WRITE_ROWS_EVENTv0, replication.WRITE_ROWS_EVENTv1, replication.WRITE_ROWS_EVENTv2,
		replication.UPDATE_ROWS_EVENTv0, replication.UPDATE_ROWS_EVENTv1, replication.UPDATE_ROWS_EVENTv2,
		replication.DELETE_ROWS_EVENTv0, replication.DELETE_ROWS_EVENTv1, replication.DELETE_ROWS_EVENTv2:
		return fmt.Sprintf("`%s`.`%s`",
			string(event.Event.(*replication.RowsEvent).Table.Schema),
			string(event.Event.(*replication.RowsEvent).Table.Table))
	}
	return ""
}