Skip to content
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

Merged
merged 9 commits into from
Nov 3, 2015
Merged

Support date_sub function #485

merged 9 commits into from
Nov 3, 2015

Conversation

zimulala
Copy link
Contributor

@siddontang
Copy link
Member

What does Cast mean?

@zimulala
Copy link
Contributor Author

here means calculation

@siddontang
Copy link
Member

cast is not for calculation, it means conversation.

@zimulala
Copy link
Contributor Author

It has calculated the meanings in the dictionary, here it may not be an appropriate name. Do you have a suggestion?

@siddontang
Copy link
Member

DateArith or DateArithmetic

@zimulala
Copy link
Contributor Author

gotcha, DateCast will be renamed DateArith.

@@ -2285,12 +2286,22 @@ FunctionCallNonKeyword:
}
| "DATE_ADD" '(' Expression ',' "INTERVAL" Expression TimeUnit ')'
{
$$ = &expression.DateAdd{
$$ = &expression.DateArith{
Op:"ADD",
Copy link
Member

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
)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it.

@zimulala
Copy link
Contributor Author

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
Copy link
Member

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
)

Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha

@zimulala
Copy link
Contributor Author

zimulala commented Nov 2, 2015

PTAL @siddontang

@siddontang
Copy link
Member

LGTM

zimulala added a commit that referenced this pull request Nov 3, 2015
@zimulala zimulala merged commit c49df39 into master Nov 3, 2015
@zimulala zimulala deleted the zimuxia/date-sub branch November 3, 2015 01:46
YuJuncen pushed a commit to YuJuncen/tidb that referenced this pull request Apr 23, 2021
* wait sub task finish before exit

* add a comment
nolouch pushed a commit to nolouch/tidb that referenced this pull request Jul 21, 2023
* add gc black list

Signed-off-by: ystaticy <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants