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 MySQL CAST_TIME/CAST_DATE/CAST_DATETIME function #606

Merged
merged 19 commits into from
Feb 9, 2023
Merged

Support MySQL CAST_TIME/CAST_DATE/CAST_DATETIME function #606

merged 19 commits into from
Feb 9, 2023

Conversation

csynineyang
Copy link
Contributor

转换需求:非标准格式时间字符串转成标准格式时间字符串

cast_time.go
cast_time_test.go
解析格式(分割符固定为冒号):
1)+-D hhh:mm:ss.ms,+-D hhh:mm.ms,+-D hhh.ms
2)+-hhh:mm:ss.ms,+-hhh:mm.ms
3)+-hhhmmss.ms,+-mmss.ms,+-ss.ms
统一输出:
+-hhh:mm:ss

cast_date.go
cast_date_test.go
解析格式(分割符为任意个非字母数字符号):
1)YY-MM-DD, YYYY-MM-DD
2)YYYYMMDD, YYMMDD
统一输出:
YYYY-MM-DD

cast_datetime.go
cast_datetime_test.go
解析格式(分割符为任意个非字母数字符号):
1)YYYY-MM-DD hh:mm:ss.ms, YY-MM-DD hh:mm:ss.ms
2)YYYYMMDDhhmmss.ms, YYMMDDhhmmss.ms
统一输出:
YYYY-MM-DD hh:mm:ss

排除Carbon函数库,理由是:函数库支持对标准时间格式进行各类加减和比较运算,不符合需求

@codecov-commenter
Copy link

codecov-commenter commented Jan 17, 2023

Codecov Report

Base: 35.82% // Head: 36.95% // Increases project coverage by +1.12% 🎉

Coverage data is based on head (9c083ca) compared to base (e037f9a).
Patch coverage: 87.24% of modified lines in pull request are covered.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #606      +/-   ##
==========================================
+ Coverage   35.82%   36.95%   +1.12%     
==========================================
  Files         195      198       +3     
  Lines       21659    22145     +486     
==========================================
+ Hits         7759     8183     +424     
- Misses      13006    13053      +47     
- Partials      894      909      +15     
Impacted Files Coverage Δ
pkg/runtime/function/cast_time.go 85.20% <85.20%> (ø)
pkg/runtime/function/cast_date.go 88.00% <88.00%> (ø)
pkg/runtime/function/cast_datetime.go 88.62% <88.62%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dongzl dongzl added this to the 0.2.0 milestone Jan 17, 2023
@dongzl dongzl added the SQL SQL support label Jan 17, 2023
@dongzl
Copy link
Contributor

dongzl commented Jan 17, 2023

ref #569 #568 #570

Copy link
Contributor

@jjeffcaii jjeffcaii left a comment

Choose a reason for hiding this comment

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

Please fix

@csynineyang csynineyang closed this Feb 2, 2023
@csynineyang csynineyang reopened this Feb 2, 2023
@jjeffcaii jjeffcaii merged commit ac942f6 into arana-db:master Feb 9, 2023
GavinLam164 pushed a commit to GavinLam164/arana that referenced this pull request Feb 25, 2023
…-db#606)

* add node config support (arana-db#464)

* Support MySQL CAST_CHAR function.

* format style

* Support MySQL CAST_TIME function. (arana-db#570)

* Support MySQL CAST_DATE function. (arana-db#569)

* Support MySQL CAST_DATETIME function. (arana-db#568)

* Support MySQL CAST_TIME/CAST_DATE/CAST_DATETIME function

* Resolve Conversation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SQL SQL support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants