mirror of https://github.com/Wox-launcher/Wox
refactor(setting): remove SynableStore interface and related logic
* Eliminated the `SynableStore` interface from `SettingStore` to simplify the architecture. * Removed the unused `syncStore` field from `SettingValue` struct and its related logic in the `Set` method. * This change enhances code clarity and maintainability by reducing complexity.
This commit is contained in:
parent
5be879167f
commit
974010a6da
|
@ -20,10 +20,6 @@ type SettingStore interface {
|
||||||
Delete(key string) error
|
Delete(key string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
type SynableStore interface {
|
|
||||||
LogOplog(key string, value interface{}) error
|
|
||||||
}
|
|
||||||
|
|
||||||
type WoxSettingStore struct {
|
type WoxSettingStore struct {
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ type SettingValue[T any] struct {
|
||||||
|
|
||||||
defaultValue T
|
defaultValue T
|
||||||
settingStore SettingStore
|
settingStore SettingStore
|
||||||
syncStore SynableStore
|
|
||||||
validator ValidatorFunc[T]
|
validator ValidatorFunc[T]
|
||||||
syncable bool
|
syncable bool
|
||||||
isLoaded bool
|
isLoaded bool
|
||||||
|
@ -170,10 +169,5 @@ func (v *SettingValue[T]) Set(newValue T) error {
|
||||||
|
|
||||||
v.value = newValue
|
v.value = newValue
|
||||||
v.isLoaded = true
|
v.isLoaded = true
|
||||||
|
|
||||||
if v.syncable {
|
|
||||||
return v.syncStore.LogOplog(v.key, newValue)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
BIN
wox.core/wox
BIN
wox.core/wox
Binary file not shown.
Loading…
Reference in New Issue