Comments (5)
这个不是bug,像你说的,为了解决gorm批量更新字段时,零值字段不更新的问题。你说的用户密码的情况是种特殊情况,类似这种特殊情况可以不指定指针,这块可以按照具体业务需求来确定。
from gin-admin.
哦,这样哈,我使用的场景下,有很多会涉及到只修改其中一两个字段,我这边新增的业务逻辑里面,已经改成update可以只传其中任意字段,只修改传的这部分参数,有些字段不希望在前端展示
from gin-admin.
还有个bll中和model中,的接口部分,参数都不用指针,返回值用指针,这个为啥,都用指针不是更好吗
from gin-admin.
参数作为指针,我考虑的原因有两个,一是传递指针你需要在使用参数值时进行空指针判定,否则会引起panic,而是指针作为引用传递,函数内部更改指针的值会引起外部的数据变化,外部使用时可能会出现数据混乱的情况;返回值作为指针就好理解了,如果出现错误,我们都希望以nil作为返回值输出,而不是空的结构体。
from gin-admin.
嗯,谢谢
from gin-admin.
Related Issues (20)
- Start failed - sonyflake not created HOT 2
- ParseJSON 建议优化一下
- 有人在生产中使用吗
- swagger 报错:No operations defined in spec!
- 有人遇到过程序偶尔自己退出的问题吗
- 问个不关代码的,V10什么时候发 HOT 7
- Injector结构体的CasbinEnforcer、Auth字段是否多余 HOT 1
- TablePrefix没有生效 HOT 3
- jwtauth store service is not working ?
- Failed to read configuration file
- rbac_model.conf should use keyMatch3 HOT 1
- gin-admin-cli生成的项目有问题 HOT 3
- 感觉启动速度有点慢
- 有交流群吗 HOT 1
- gin-admin-cli生成代码报错 HOT 1
- /api/v1/loggers?current=1&pageSize=10 ERROR: column b.id does not exist (SQLSTATE 42703) HOT 1
- [功能建议] Module 是不是可以考虑使用接口 ?
- Error while generate a new module
- 移动前端api 怎么实现 HOT 1
- is there a way to generate ReactJS files from Swagger?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gin-admin.