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

重构和扩展sql参数的后缀函数 #51

Open
wayshall opened this issue Mar 6, 2023 · 2 comments
Open

重构和扩展sql参数的后缀函数 #51

wayshall opened this issue Mar 6, 2023 · 2 comments
Milestone

Comments

@wayshall
Copy link
Owner

wayshall commented Mar 6, 2023

现在只支持无参数的后缀函数

@wayshall wayshall added this to the 5.0.0 milestone Mar 6, 2023
@wayshall
Copy link
Owner Author

wayshall commented Mar 6, 2023

5.0版本后增加了参数支持
目前Date类型的参数增加了两个带参数的后缀函数:minutes_ago, minutes_later.
用于需要对时间参数类型处理,比如需要查询某个特定时间前后30分钟的数据时,可以这样写:

select 
    d.*
from 
    data d
where
    1=1 
[#if request.uploadTime??]
    and d.upload_time between :request.uploadTime?$30_minutes_ago and :request.uploadTime?$30_minutes_later
[/#if]

wayshall added a commit that referenced this issue Mar 6, 2023
wayshall added a commit that referenced this issue Mar 6, 2023
主要是重构包名

fix #51
@wayshall
Copy link
Owner Author

wayshall commented Jul 4, 2023

补充后缀函数规则:
以下划线“”分割为字符为数组,$开头的视作参数,其余部分再用下划线“”连接起来,作为需要调用的方法名
如:d.upload_time <= :request.uploadTime?$30_minutes_ago
将会调用minutesAgo(30) 或者 minutes_ago(30)

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

No branches or pull requests

1 participant