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

in查询功能的实现 #102

Merged
merged 8 commits into from
Nov 15, 2022
Merged

in查询功能的实现 #102

merged 8 commits into from
Nov 15, 2022

Conversation

juniaoshaonian
Copy link
Collaborator

No description provided.

column.go Outdated Show resolved Hide resolved
Copy link
Contributor

@flycash flycash left a comment

Choose a reason for hiding this comment

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

  • 在 .CHANGELOG 里面,把这个合并请求加进去;
  • 看看 Github 的 action,修复一下 deepsource 之类的问题

@flycash
Copy link
Contributor

flycash commented Nov 8, 2022

unused receiver 错误你只需要删掉那个 receiver 的名字就可以

select_test.go Show resolved Hide resolved
@flycash
Copy link
Contributor

flycash commented Nov 8, 2022

另外我有一个地方想要问问你的看法,就是某些时候使用 In 查询我们会遇到这么一个问题,就是我也不知道里面有没有元素。如果按照现在的逻辑,假如输入是空的话,那么生成的是:

SELECT * FROM XXX WHERE `id` IN ()

还有两种可以考虑的方向:

SELECT * FROM xxx WHERE true;
SELECT * FROM xxx WHERE false;

第一个意思是,如果要是 In 的候选元素不存在,就认为不需要这个查询条件,所以用 true。
第二个的意思是,如果In的元素没有,认为数据库根本筛选不出来任何结果,所以用 false。

@flycash flycash linked an issue Nov 8, 2022 that may be closed by this pull request
@flycash flycash mentioned this pull request Nov 8, 2022
@juniaoshaonian
Copy link
Collaborator Author

另外我有一个地方想要问问你的看法,就是某些时候使用 In 查询我们会遇到这么一个问题,就是我也不知道里面有没有元素。如果按照现在的逻辑,假如输入是空的话,那么生成的是:

SELECT * FROM XXX WHERE `id` IN ()

还有两种可以考虑的方向:

SELECT * FROM xxx WHERE true;
SELECT * FROM xxx WHERE false;

第一个意思是,如果要是 In 的候选元素不存在,就认为不需要这个查询条件,所以用 true。 第二个的意思是,如果In的元素没有,认为数据库根本筛选不出来任何结果,所以用 false。

我偏向于第二种,如果说是第一种并且后面没有其他条件的话就变成遍历全表了。表比较大的话会比较慢。

@flycash
Copy link
Contributor

flycash commented Nov 9, 2022

另外我有一个地方想要问问你的看法,就是某些时候使用 In 查询我们会遇到这么一个问题,就是我也不知道里面有没有元素。如果按照现在的逻辑,假如输入是空的话,那么生成的是:

SELECT * FROM XXX WHERE `id` IN ()

还有两种可以考虑的方向:

SELECT * FROM xxx WHERE true;
SELECT * FROM xxx WHERE false;

第一个意思是,如果要是 In 的候选元素不存在,就认为不需要这个查询条件,所以用 true。 第二个的意思是,如果In的元素没有,认为数据库根本筛选不出来任何结果,所以用 false。

我偏向于第二种,如果说是第一种并且后面没有其他条件的话就变成遍历全表了。表比较大的话会比较慢。

那可以,你修改一下代码,然后在In 和 NotIn 两个方法的注释里面说清楚,如果要是每元素的话,In 这个会被认为是 false。

@codecov
Copy link

codecov bot commented Nov 10, 2022

Codecov Report

Merging #102 (e16ce84) into main (e929bd4) will increase coverage by 0.18%.
The diff coverage is 84.09%.

@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
+ Coverage   82.72%   82.91%   +0.18%     
==========================================
  Files          18       18              
  Lines        1146     1188      +42     
==========================================
+ Hits          948      985      +37     
- Misses        169      173       +4     
- Partials       29       30       +1     
Impacted Files Coverage Δ
predicate.go 90.00% <ø> (ø)
builder.go 80.76% <78.57%> (-0.22%) ⬇️
column.go 87.87% <86.66%> (+1.96%) ⬆️

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

column.go Outdated Show resolved Hide resolved
column.go Outdated Show resolved Hide resolved
predicate.go Outdated Show resolved Hide resolved
@flycash
Copy link
Contributor

flycash commented Nov 10, 2022

format go code 错误,是指你需要运行一下 make setup 安装好各种 hook,然后提交之前运行一下 make check,它会格式化代码并且做静态检查

@flycash flycash merged commit 4b09178 into ecodeclub:main Nov 15, 2022
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.

eorm: IN 查询支持
2 participants