You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
selectSql: "select * from student where id in (?,?)",
39
40
tables: []string{"student_1", "student_5"},
41
+
pk: "id",
40
42
args: []interface{}{1, 5},
41
-
expectedGenerateSql: "(SELECT * FROM `student_1` WHERE `id` IN (?,?)) UNION ALL (SELECT * FROM `student_5` WHERE `id` IN (?,?))",
43
+
expectedGenerateSql: "SELECT * FROM ((SELECT * FROM `student_1` WHERE `id` IN (?,?)) UNION ALL (SELECT * FROM `student_5` WHERE `id` IN (?,?))) t ORDER BY `id` ASC",
42
44
},
43
45
{
44
46
selectSql: "select * from student where id in (?,?) order by id desc",
45
47
tables: []string{"student_1", "student_5"},
48
+
pk: "id",
46
49
args: []interface{}{1, 5},
47
50
expectedGenerateSql: "SELECT * FROM ((SELECT * FROM `student_1` WHERE `id` IN (?,?) ORDER BY `id` DESC) UNION ALL (SELECT * FROM `student_5` WHERE `id` IN (?,?) ORDER BY `id` DESC)) t ORDER BY `id` DESC",
48
51
},
49
52
{
50
53
selectSql: "select * from student where id in (?,?) order by id desc limit ?, ?",
51
54
tables: []string{"student_1", "student_5"},
55
+
pk: "id",
52
56
args: []interface{}{1, 5, 1000, 20},
53
-
expectedGenerateSql: "SELECT * FROM ((SELECT * FROM `student_1` WHERE `id` IN (?,?) ORDER BY `id` DESC limit 1020) UNION ALL (SELECT * FROM `student_5` WHERE `id` IN (?,?) ORDER BY `id` DESC limit 1020)) t ORDER BY `id` DESC",
57
+
expectedGenerateSql: "SELECT * FROM ((SELECT * FROM `student_1` WHERE `id` IN (?,?) ORDER BY `id` DESC LIMIT 1020) UNION ALL (SELECT * FROM `student_5` WHERE `id` IN (?,?) ORDER BY `id` DESC LIMIT 1020)) t ORDER BY `id` DESC",
0 commit comments