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

支持使用组合定义模型 #99

Merged
merged 3 commits into from
Oct 24, 2022
Merged

Conversation

flyhigher139
Copy link
Collaborator

@flyhigher139 flyhigher139 commented Oct 21, 2022

#70
完成组合,并添加了测试用例

@flyhigher139 flyhigher139 changed the title 支持使用组合定义模型 #70 支持使用组合定义模型 Oct 21, 2022
@flyhigher139 flyhigher139 marked this pull request as ready for review October 21, 2022 07:52
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.

设计用例设计得不错。可以帮忙重构一下这个测试用例吗?就是在三个地方都写一遍字段的元数据有点崩溃,改成大概这样的一个方法:

wantMeta: newTableMeta(tableName, columns)

columns 就是按照顺序放好的,然后内部把这个转成对应的两个 map,我觉得很能简化代码。

嘿嘿早期我这样测试,是因为早期我的元数据很简单,后面加多了之后我也没有改过来

internal/model/model.go Show resolved Hide resolved
@flyhigher139
Copy link
Collaborator Author

在三个地方都写一遍字段的元数据有点崩溃,改成大概这样的一个方法:

wantMeta: newTableMeta(tableName, columns)

columns 就是按照顺序放好的,然后内部把这个转成对应的两个 map

收到~

这里你能不能直接试一下就是用 structField.Index 我记得里面有一个字段大概叫做这个,然后是一个 []int,我有点忘了它是不是就能够直接拿到这个东西,也就是从组合最外面到达这个字段本身的各级的索引

收到~

@codecov
Copy link

codecov bot commented Oct 23, 2022

Codecov Report

Merging #99 (3544b67) into main (6c7dcac) will increase coverage by 0.11%.
The diff coverage is 92.50%.

@@            Coverage Diff             @@
##             main      #99      +/-   ##
==========================================
+ Coverage   81.61%   81.72%   +0.11%     
==========================================
  Files          17       17              
  Lines        1077     1100      +23     
==========================================
+ Hits          879      899      +20     
- Misses        169      171       +2     
- Partials       29       30       +1     
Impacted Files Coverage Δ
internal/model/model.go 90.19% <92.50%> (-0.95%) ⬇️

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

@flycash flycash merged commit eacfdac into ecodeclub:main Oct 24, 2022
@flycash
Copy link
Contributor

flycash commented Oct 24, 2022

@flyhigher139 接下来,你需要在构造 SQL 和执行查询的那些地方都加一些测试用例。按照道理来说,应该能够直接运行,毕竟我们只依赖于元数据。

然后你确认一下那个 parents 字段,在使用 index 之后我觉得那个可能用不上了

@flyhigher139
Copy link
Collaborator Author

@flyhigher139 接下来,你需要在构造 SQL 和执行查询的那些地方都加一些测试用例。按照道理来说,应该能够直接运行,毕竟我们只依赖于元数据。

然后你确认一下那个 parents 字段,在使用 index 之后我觉得那个可能用不上了

好的~

@flyhigher139 flyhigher139 deleted the combination branch November 10, 2022 15:01
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.

2 participants