// getSchema returns a fake schema object that can be given to SplitParams func getTestSchema() map[string]*schema.Table { table := schema.Table{ Name: "test_table", } zero, _ := sqltypes.BuildValue(0) table.AddColumn("id", sqltypes.Int64, zero, "") table.AddColumn("int32_col", sqltypes.Int32, zero, "") table.AddColumn("uint32_col", sqltypes.Uint32, zero, "") table.AddColumn("int64_col", sqltypes.Int64, zero, "") table.AddColumn("uint64_col", sqltypes.Uint64, zero, "") table.AddColumn("float32_col", sqltypes.Float32, zero, "") table.AddColumn("float64_col", sqltypes.Float64, zero, "") table.AddColumn("user_id", sqltypes.Int64, zero, "") table.AddColumn("user_id2", sqltypes.Int64, zero, "") table.AddColumn("id2", sqltypes.Int64, zero, "") table.AddColumn("count", sqltypes.Int64, zero, "") table.PKColumns = []int{0, 7} addIndexToTable(&table, "PRIMARY", "id", "user_id") addIndexToTable(&table, "idx_id2", "id2") addIndexToTable(&table, "idx_int64_col", "int64_col") addIndexToTable(&table, "idx_uint64_col", "uint64_col") addIndexToTable(&table, "idx_float64_col", "float64_col") addIndexToTable(&table, "idx_id_user_id", "id", "user_id") addIndexToTable(&table, "idx_id_user_id_user_id_2", "id", "user_id", "user_id2") table.SetMysqlStats( int64Value(1000), /* TableRows */ int64Value(100), /* DataLength */ int64Value(123), /* IndexLength */ int64Value(456), /* DataFree */ ) result := make(map[string]*schema.Table) result["test_table"] = &table tableNoPK := schema.Table{ Name: "test_table_no_pk", } tableNoPK.AddColumn("id", sqltypes.Int64, zero, "") tableNoPK.PKColumns = []int{} result["test_table_no_pk"] = &tableNoPK return result }
// GetSchema returns a fake schema object that can be given to SplitParams func GetSchema() map[string]*schema.Table { table := schema.Table{ Name: "test_table", } zero, _ := sqltypes.BuildValue(0) table.AddColumn("id", sqltypes.Int64, zero, "") table.AddColumn("int32_col", sqltypes.Int32, zero, "") table.AddColumn("uint32_col", sqltypes.Uint32, zero, "") table.AddColumn("int64_col", sqltypes.Int64, zero, "") table.AddColumn("uint64_col", sqltypes.Uint64, zero, "") table.AddColumn("float32_col", sqltypes.Float32, zero, "") table.AddColumn("float64_col", sqltypes.Float64, zero, "") table.AddColumn("user_id", sqltypes.Int64, zero, "") table.AddColumn("user_id2", sqltypes.Int64, zero, "") table.AddColumn("id2", sqltypes.Int64, zero, "") table.AddColumn("count", sqltypes.Int64, zero, "") table.PKColumns = []int{0, 7} addIndexToTable(&table, "PRIMARY", "id", "user_id") addIndexToTable(&table, "idx_id2", "id2") addIndexToTable(&table, "idx_int64_col", "int64_col") addIndexToTable(&table, "idx_uint64_col", "uint64_col") addIndexToTable(&table, "idx_float64_col", "float64_col") addIndexToTable(&table, "idx_id_user_id", "id", "user_id") addIndexToTable(&table, "idx_id_user_id_user_id_2", "id", "user_id", "user_id2") result := make(map[string]*schema.Table) result["test_table"] = &table tableNoPK := schema.Table{ Name: "test_table_no_pk", } tableNoPK.AddColumn("id", sqltypes.Int64, zero, "") tableNoPK.PKColumns = []int{} result["test_table_no_pk"] = &tableNoPK return result }