-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support date_sub function #485
Conversation
add date_sub operation test
What does Cast mean? |
here means calculation |
cast is not for calculation, it means conversation. |
It has calculated the meanings in the dictionary, here it may not be an appropriate name. Do you have a suggestion? |
DateArith or DateArithmetic |
gotcha, |
@@ -2285,12 +2286,22 @@ FunctionCallNonKeyword: | |||
} | |||
| "DATE_ADD" '(' Expression ',' "INTERVAL" Expression TimeUnit ')' | |||
{ | |||
$$ = &expression.DateAdd{ | |||
$$ = &expression.DateArith{ | |||
Op:"ADD", |
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.
use a const int value instead of string, like
const (
DateAdd
DateSub
)
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.
got it.
PTAL |
const ( | ||
// DateAdd is to run date_add function option. | ||
// See: https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_date-add | ||
DateAdd = 1 |
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 prefer to use iota, like
type xxxType byte
const (
DateAdd xxxType = iota +1
DateSub
)
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.
+1
Btw, you can implement String() for DateArithType.
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.
gotcha
PTAL @siddontang |
LGTM |
* wait sub task finish before exit * add a comment
* add gc black list Signed-off-by: ystaticy <[email protected]>
#419