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

all: Field 取代 FieldByName #83

Merged
merged 0 commits into from Aug 22, 2022
Merged

Conversation

longyue0521
Copy link
Collaborator

  1. mode.go 添加Index字段
  2. mode_test.go 测试Index字段
  3. reflect.go 使用自定义field方法(本质reflect.Value.Field)替换reflect.Value.FieldByName方法
  4. unsafe_test.go 添加测试用例NullBoolPtr

@longyue0521
Copy link
Collaborator Author

@codecov
Copy link

codecov bot commented Aug 19, 2022

Codecov Report

Merging #83 (f275ff1) into main (c11ee3b) will increase coverage by 0.09%.
The diff coverage is 46.96%.

❗ Current head f275ff1 differs from pull request most recent head e434fd6. Consider uploading reports for the commit e434fd6 to get more accurate results

@@            Coverage Diff             @@
##             main      #83      +/-   ##
==========================================
+ Coverage   81.56%   81.66%   +0.09%     
==========================================
  Files          17       17              
  Lines        1123     1129       +6     
==========================================
+ Hits          916      922       +6     
  Misses        175      175              
  Partials       32       32              
Impacted Files Coverage Δ
internal/test/types.go 31.16% <0.00%> (ø)
transaction.go 40.00% <ø> (ø)
update.go 82.90% <ø> (ø)
builder.go 80.85% <100.00%> (ø)
db.go 76.66% <100.00%> (ø)
insert.go 92.20% <100.00%> (ø)
internal/model/model.go 91.13% <100.00%> (+0.11%) ⬆️
internal/valuer/reflect.go 79.06% <100.00%> (+2.75%) ⬆️
internal/valuer/unsafe.go 93.93% <100.00%> (ø)
select.go 88.88% <100.00%> (ø)

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

@flycash
Copy link
Contributor

flycash commented Aug 19, 2022

deepsource 里面有一个检查没过,你可以把 field 改成 fieldByIdex?或者你有更好的名字?

@flycash flycash linked an issue Aug 19, 2022 that may be closed by this pull request
@flycash flycash changed the title eorm, internal/mode, internal/valuer/reflect: 解决#81 eorm, internal/model, internal/valuer/reflect: Field 取代 FieldByName Aug 19, 2022
@flycash flycash changed the title eorm, internal/model, internal/valuer/reflect: Field 取代 FieldByName all: Field 取代 FieldByName Aug 19, 2022
internal/valuer/reflect.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.

  • 把 field 的名字改一下,然后加一个 bool 作为返回值,== (reflect.Value) 还是比较丑的。
  • 然后把 Index 改成 FieldIndex
  • 然后在 .CHANGELOG 里面加一条记录,也就是这个 MR

@longyue0521
Copy link
Collaborator Author

不好意思,因为处理冲突不当导致本PR被关闭了, 请移步至#90

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.

valuer/reflect: 用 Field 取代 FieldByName
2 participants