-
Notifications
You must be signed in to change notification settings - Fork 62
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
目录直接相关的 API #234
目录直接相关的 API #234
Conversation
RanKKI
commented
Oct 8, 2022
•
edited
Loading
edited
h.i.Get may return two type of errors, not found and db error resp should behave differently
✅ Deploy Preview for bangumi-org-server ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Codecov ReportBase: 49.55% // Head: 51.07% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #234 +/- ##
==========================================
+ Coverage 49.55% 51.07% +1.52%
==========================================
Files 198 204 +6
Lines 7804 8153 +349
==========================================
+ Hits 3867 4164 +297
- Misses 3480 3507 +27
- Partials 457 482 +25
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
这个PR是可以review了吗?改一下openapi文件? |
不好意思,这两天在忙别的, 先 review 代码吧, openapi 我今天晚点补上 |
This reverts commit dbcd78e.
看下slack私聊 |
Comment: s.Comment, | ||
Subject: sub, | ||
} | ||
} | ||
|
||
return results, nil | ||
} | ||
|
||
func (r mysqlRepo) AddOrUpdateIndexSubject( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是不是应该包在一个事务里
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不需要吧,前面都是查询, 后面要么改或者增,没必要用事务
但我觉得这要加锁,避免创建两份目录
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不需要吧,前面都是查询, 后面要么改或者增,没必要用事务
但我觉得这要加锁,避免创建两份目录
同时发两个请求的话有可能添加两个条目进目录吧,或者因为有unique key(没看sql表怎么定义的)而出错
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
嗯, 用事务也没法解决。
感觉对于这种创建资源的 还是应该是一定时间内阻止一样的请求 #233
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个要不我写个中间件 drop 请求吧.. 没啥别的好的想法解决这个问题了
(在我其他地方是这么写的,但不是很确定是不是最好的办法,会不会太过繁琐了一点。) |
这个type是条目类型,cat不知道是什么,可能只是我们没用到。 |
我看了下代码,之前是用 cat 做的分类,没有见到过 type 字段。 昨天还发现一点问题, |
我突然发现忘了做角色和人物的相关功能了,你有兴趣补一下吗( |
我先把目录的补完吧, |
OK |
合并一下主线( |
lint没过 |
是 ctrl 里的一个lint, 我打算再开个pr修来着,毕竟和这次功能没啥关系..Hugh(Hui) LiuKind Regards On Oct 21, 2022, at 18:38, Trim21 ***@***.***> wrote:
lint没过
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
需要把 |
报错是报在了其他文件,但是是这个PR引起的 |
发现了.. 我这报错在 |
sai老板还在摸,再等等( |
sai老板给权限了( 和了一个别的PR,有个冲突 |
|
||
indexSubject, err := r.q.IndexSubject.WithContext(ctx). | ||
Where(r.q.IndexSubject.IndexID.Eq(id), r.q.IndexSubject.SubjectID.Eq(uint32(subjectID))). | ||
FirstOrInit() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FirstOrInit
还会返回gorm.ErrRecordNotFound
吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
而且这里Init
了,indexSubject.ID
还是0吗。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FirstOrInit
还会返回gorm.ErrRecordNotFound
吗?
不会,确实判断的有点多余了
而且这里
Init
了,indexSubject.ID
还是0吗。
这里主要是初始化对象,使 indexSubject
不会是 nil, 然后里面的数据都是默认值, Int 默认就是 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那下面convertDao失败的话岂不是会留一条错误纪录在里面...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
咦,convertDao 在 firstOrInit 上面呀。
如果 convert 失败了, 错误就直接出去了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
啊 确实,看错了