Chore: remove xorm from preference (#53803)

* Chore: remove xorm from preference

* separte feature toggle

* fix comments

* fix comments

* remove the dublicated namedexec
This commit is contained in:
ying-jeanne
2022-08-17 22:07:20 -04:00
committed by GitHub
parent 4ac87a3b3b
commit 82b63688d2
10 changed files with 247 additions and 103 deletions
+11 -4
View File
@@ -18,13 +18,20 @@ type Service struct {
}
func ProvideService(db db.DB, cfg *setting.Cfg, features *featuremgmt.FeatureManager) pref.Service {
return &Service{
store: &sqlStore{
db: db,
},
service := &Service{
cfg: cfg,
features: features,
}
if cfg.IsFeatureToggleEnabled("newDBLibrary") {
service.store = &sqlxStore{
sess: db.GetSqlxSession(),
}
} else {
service.store = &sqlStore{
db: db,
}
}
return service
}
func (s *Service) GetWithDefaults(ctx context.Context, query *pref.GetPreferenceWithDefaultsQuery) (*pref.Preference, error) {