-
Notifications
You must be signed in to change notification settings - Fork 109
Conversation
This is not nice to have solution, but at least it fixes: #524, #520, so I'm totally open for any alternative approaches. So far I tested against following combination of queries: SELECT commit_hash AS `commit_hash` FROM commits GROUP BY commit_hash;
SELECT commit_hash AS `commit_hash` FROM commits GROUP BY 1;
SELECT SUBSTRING(`commits`.`commit_hash`, 1, 5) AS `commit_hash` FROM commits GROUP BY commit_hash;
SELECT SUBSTRING(`commits`.`commit_hash`, 1, 5) AS `commit_hash` FROM commits GROUP BY 1;
SELECT count(commit_hash), repository_id FROM commits GROUP BY 2;
SELECT SUBSTRING(`repositories`.`repository_id`, 1, 1024) AS `repository_id`
FROM `repositories`
INNER JOIN `files` ON (`repositories`.`repository_id` = SUBSTRING(`files`.`repository_id`, 1, 1024))
GROUP BY 1; |
@@ -243,7 +243,7 @@ func TestTime_DayOfWeek(t *testing.T) { | |||
{"null date", sql.NewRow(nil), nil, false}, | |||
{"invalid type", sql.NewRow([]byte{0, 1, 2}), nil, false}, | |||
{"date as string", sql.NewRow(stringDate), int32(3), false}, | |||
{"date as time", sql.NewRow(time.Now()), int32(time.Now().UTC().Weekday()+1) % 7, false}, | |||
{"date as time", sql.NewRow(time.Now()), int32(time.Now().UTC().Weekday() + 1), false}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if weekday == 6 it would return 7, MySQL weekday index range is [0, 6] https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_weekday
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it because tests were failing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is testing a DayOfWeek (not weekday): https://dev.mysql.com/doc/refman/8.0/en/date-and-time-functions.html#function_dayofweek
just expected value was specified by go's weekday, so there is no need for %
@erizocosmico could you have a look? |
Signed-off-by: kuba-- <kuba@sourced.tech>
Signed-off-by: kuba-- <kuba@sourced.tech>
Signed-off-by: kuba-- kuba@sourced.tech
Closes: #520, #524, #535