refactor(common): toolbox config api - #509
Merged
Merged
Conversation
renbaoshuo
requested review from
a team,
jiuxia211,
mutezebra and
ozline
as code owners
July 31, 2026 03:35
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #509 +/- ##
==========================================
+ Coverage 63.51% 64.07% +0.56%
==========================================
Files 234 239 +5
Lines 6169 6450 +281
==========================================
+ Hits 3918 4133 +215
- Misses 2127 2162 +35
- Partials 124 155 +31
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 5 files with indirect coverage changes 🚀 New features to boost your workflow:
|
ACaiCat
reviewed
Jul 31, 2026
ACaiCat
reviewed
Aug 2, 2026
Member
Author
|
那得改一下表定义了
…---
Best Regards,
Baoshuo
https://baoshuo.ren
Cai ***@***.***> 于 2026年8月2日周日 17:14写道:
***@***.**** commented on this pull request.
------------------------------
On pkg/db/toolbox/manage_configs_test.go
<#509 (comment)>
:
应该和其他测试一样写成 testCase 子测试形式
------------------------------
In pkg/db/toolbox/create_config.go
<#509 (comment)>
:
> - {Name: "platform"},
- {Name: "version"},
- },
- DoUpdates: clause.AssignmentColumns([]string{
- "visible",
- "name",
- "icon",
- "type",
- "message",
- "extra",
- "updated_at",
- }),
- }).Create(config).Error
+func (c *DBToolbox) CreateToolboxConfig(ctx context.Context, config *model.ToolboxConfig) error {
+ err := c.client.WithContext(ctx).Table(constants.ToolboxConfigTableName).Create(config).Error
+ if errors.Is(err, gorm.ErrDuplicatedKey) {
现在建表语句
UNIQUE KEY `uk_toolbox_config` (`tool_id`, `student_id`, `platform`, `version`)
因为MySQL里NULL!=NULL,所以student_id, platform, version只要有一个为NULL就不受这个约束影响,可以无限插入,可能不太符合预期,需要业务层判断一下重复
(?
—
Reply to this email directly, view it on GitHub
<#509?email_source=notifications&email_token=ALHJ6YCJDEVGM4R24CVAZJT5H4A7JA5CNFSNUABKM5UWIORPF5TWS5BNNB2WEL2QOVWGYUTFOF2WK43UKJSXM2LFO4XTIOBTG44DEOBQGEY2M4TFMFZW63VGMF2XI2DPOKSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#pullrequestreview-4837828011>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALHJ6YGY6VMSNRETJQFAIP35H4A7JAVCNFSNUABFKJSXA33TNF2G64TZHM3DQOJYG44DIOBRHNEXG43VMU5TKMBSGYYTONZTGIY2C5QC>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
ACaiCat
approved these changes
Aug 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
自查 PR 结构
PR 标题符合这个格式: <type>(optional scope): <description>
此 PR 标题的描述以用户为导向,足够清晰,其他人可以理解。
我已经对所有 commit 提供了签名(GPG 密钥签名、SSH 密钥签名)
这个 PR 属于强制变更/破坏性更改
这个 PR 的类型是什么?
refactor
这个 PR 做了什么 / 我们为什么需要这个 PR?
重构工具箱管理接口。
(可选)这个 PR 解决了哪个/些 issue?
对 Reviewer 预留的一些提醒