feat: add lower and upper #945
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What did this pull request do?
给 field.String 添加了
Lower
方法 和Upper
方法,个人认为他们虽然是两个方法,但功能类似,是作用相反的一对,所以放到一个 pr 中了添加这两个方法的原因是目前 gen 好像无法方便的使用除生成外的其他 sql 方法
以下是我在Issues搜索时看到的,作为参考
二是 Lower 和 Upper 在 sql-92 compatible 中有定义,有广泛的兼容性
User Case Description
在使用 like 搜索的场景时,经常会有“不区分大小写”的场景,除了使用各sql方言的特殊方法,比如 postgres 的 'ilike',另一种简单粗暴的方法就是用 Lower 将关键词和内容都转为小写,以下是该方法使用例子