ecodeclub / eorm

简单 ORM 框架
Apache License 2.0
194 stars 64 forks source link

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

Closed flyhigher139 closed 1 year ago

flyhigher139 commented 2 years ago

70

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

flyhigher139 commented 1 year ago

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

wantMeta: newTableMeta(tableName, columns)

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

收到~

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

收到~

codecov[bot] commented 1 year ago

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%) :arrow_down:

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

flycash commented 1 year ago

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

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

flyhigher139 commented 1 year ago

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

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

好的~