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

schema和entity是不是有点重复了 #27

Open
CoderPoet opened this issue May 12, 2019 · 15 comments
Open

schema和entity是不是有点重复了 #27

CoderPoet opened this issue May 12, 2019 · 15 comments

Comments

@CoderPoet
Copy link

schema和entity是不是有点重复了,转来转去感觉有点复杂了。

@LyricTian
Copy link
Owner

嗯,会存在一些重复,不过,想要处理存储层的完全隔离,需要有一层对象层到实体层的映射。

@simon-shuffle
Copy link

确实,要是每个业务表都这么做处理累死咯....不过代码清晰干净很多,剩下就是复制粘贴的活儿....

@CoderPoet
Copy link
Author

哈哈 这个时候需要一个代码生成器

@LyricTian
Copy link
Owner

嗯,写个简单的工具就可以实现,我自己用的时候就写了一个😁

@simon-shuffle
Copy link

求大佬科普,golang如何实现代码生成,自寻资料找到这个https://github.com/goadesign/goa

@CoderPoet
Copy link
Author

嗯,写个简单的工具就可以实现,我自己用的时候就写了一个😁

大佬,工具一并开源了呀!!

@lchjczw
Copy link

lchjczw commented May 17, 2019

@LyricTian 大佬,要不把代码生成器一并开源了

@papandadj
Copy link

@lchjczw https://github.com/jinzhu/copier 这个是可以直接映射的

@CoderPoet
Copy link
Author

@lchjczw https://github.com/jinzhu/copier 这个是可以直接映射的

你的意思是直接拷贝一个,而不是弄两个结构体转来转去?

@krilie
Copy link

krilie commented Jun 26, 2019

有没有更好的处理方式 两个model包 一个bill一个scheme 还有entity 要绕死了

@CoderPoet
Copy link
Author

通通干掉 怎么简洁怎么来 :)

@krilie
Copy link

krilie commented Jun 26, 2019

简洁 不容易出错 好维护

@wangerx
Copy link

wangerx commented Jul 4, 2019

嗯,写个简单的工具就可以实现,我自己用的时候就写了一个😁

大佬,工具一并开源了呀!!

@angelporo
Copy link

确实有点绕 , 同求开源代码生成器/:B-)

@chenyu1990
Copy link
Contributor

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

No branches or pull requests

9 participants