ecodeclub / eorm

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

issue#70支持使用组合定义模型 #91

Closed mousseqin closed 2 years ago

mousseqin commented 2 years ago
  1. model文件中修改Register方法。支持普通结构体,组合,多重组合,忽略组合和冲突字段等功能。在model_test中增加测试用例。
  2. reflect文件中修改Field方法。支持组合返回字段。在reflect_test中增加测试用例。
  3. errs/error.go中新增错误标识
mousseqin commented 2 years ago

类型指针,和 string 指针是需要留着的。它们不影响你计算偏移量

好的,我重新修改一下

flycash commented 2 years ago

@mousseqin 你这个还改吗?

mousseqin commented 2 years ago

@mousseqin 你这个还改吗?

改的

flycash commented 2 years ago

Okkk, 那就慢慢来,害怕你弃坑了

mousse @.***>于2022年9月27日 周二下午3:07写道:

@mousseqin https://github.com/mousseqin 你这个还改吗?

改的

— Reply to this email directly, view it on GitHub https://github.com/gotomicro/eorm/pull/91#issuecomment-1259076022, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLWZ7WXQGABTN5QM5UJQHLWAKMLHANCNFSM6AAAAAAQDFWNUM . You are receiving this because you commented.Message ID: @.***>

mousseqin commented 2 years ago

Okkk, 那就慢慢来,害怕你弃坑了 mousse @.>于2022年9月27日 周二下午3:07写道: @mousseqin https://github.com/mousseqin 你这个还改吗? 改的 — Reply to this email directly, view it on GitHub <#91 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLWZ7WXQGABTN5QM5UJQHLWAKMLHANCNFSM6AAAAAAQDFWNUM . You are receiving this because you commented.Message ID: @.>

多谢老师鼓励,5天前给您留言了,可能你没看到。之前您说很忙,我就默认你还在忙,也没有打扰。

具体是: type TestModel struct { NickName sql.NullString } 其他问题,我当天晚上就修复了,只有这个如何判断,数据库自带的sql.NullString还没完全搞懂。所以一只卡在这里。上周六你说到这一块(好像是),我预计今晚可以提交代码。

flycash commented 2 years ago

这个东西通过判断它有没有实现 sql.Scanner 和 driver.Valuer 两个接口。这里有一个细节,就是类似sql.NullXXX ,只有它的指针才实现了两个接口

mousse @.***>于2022年9月27日 周二下午6:56写道:

Okkk, 那就慢慢来,害怕你弃坑了 mousse @.

>于2022年9月27日 周二下午3:07写道: … <#m7632724075515786800> @mousseqin https://github.com/mousseqin https://github.com/mousseqin https://github.com/mousseqin 你这个还改吗? 改的 — Reply to this email directly, view it on GitHub <#91 (comment) https://github.com/gotomicro/eorm/pull/91#issuecomment-1259076022>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLWZ7WXQGABTN5QM5UJQHLWAKMLHANCNFSM6AAAAAAQDFWNUM https://github.com/notifications/unsubscribe-auth/ACLWZ7WXQGABTN5QM5UJQHLWAKMLHANCNFSM6AAAAAAQDFWNUM . You are receiving this because you commented.Message ID: @.>

多谢老师鼓励,5天前给您留言了,可能你没看到。之前您说很忙,我就默认你还在忙,也没有打扰。

具体是: type TestModel struct { NickName

sql.NullString } 其他问题,我当天晚上就修复了,只有这个如何判断,数据库自带的 sql.NullString还没完全搞懂。所以一只卡在这里。上周六你说到这一块(好像是),我预计今晚可以提交代码。

— Reply to this email directly, view it on GitHub https://github.com/gotomicro/eorm/pull/91#issuecomment-1259331952, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLWZ7RIX3VWVUSN42S2BA3WALHGPANCNFSM6AAAAAAQDFWNUM . You are receiving this because you commented.Message ID: @.***>

flycash commented 2 years ago
image

各种失败,修一下。。。要先本地跑一下全部测试,不要直接提交。直接提交上来也是一堆错误

flycash commented 2 years ago

执行一下 make setup,它会把各种提交的钩子弄好。

mousseqin commented 2 years ago

@flycash 老师,类似BoolPtr *bool这种数据类型,我的逻辑会返回错误,所以导致大量之前的testcase不通过,是我的逻辑有问题还是需要修改那些testcase?

flycash commented 2 years ago

@flycash 老师,类似BoolPtr *bool这种数据类型,我的逻辑会返回错误,所以导致大量之前的testcase不通过,是我的逻辑有问题还是需要修改那些testcase?

你的逻辑有问题。你在组合的情况下,应该是只递归解析匿名,并且是结构体指针的东西。类似于 *bool 这种,你直接保留就可以,不需要递归解析