mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-06 07:36:37 +08:00
refactor(repository): 收敛 model/repository 分层为唯一持久化入口
将 OpenFlare 与平台业务的数据访问从 model 与 apps 直连迁入 repository, model 仅保留实体与无 IO 规则;补充 code-check 架构守卫与开发规范。
This commit is contained in:
@@ -54,7 +54,12 @@ func CreateSystemConfig(ctx context.Context, config *model.SystemConfig) error {
|
||||
|
||||
// UpdateSystemConfigFields applies partial updates to a system config row.
|
||||
func UpdateSystemConfigFields(ctx context.Context, config *model.SystemConfig, updates map[string]any) error {
|
||||
return db.DB(ctx).Model(config).Updates(updates).Error
|
||||
return UpdateSystemConfigFieldsTx(db.DB(ctx), config, updates)
|
||||
}
|
||||
|
||||
// UpdateSystemConfigFieldsTx applies partial updates within an existing transaction.
|
||||
func UpdateSystemConfigFieldsTx(tx *gorm.DB, config *model.SystemConfig, updates map[string]any) error {
|
||||
return tx.Model(config).Updates(updates).Error
|
||||
}
|
||||
|
||||
// SaveOrUpdateSystemConfig creates or updates a config row and invalidates cache.
|
||||
|
||||
Reference in New Issue
Block a user