MCPcopy Index your code
hub / github.com/bytebase/bytebase / GetSetting

Method GetSetting

backend/store/setting.go:239–256  ·  view source on GitHub ↗

GetSetting returns the setting by name.

(ctx context.Context, workspace string, name storepb.SettingName)

Source from the content-addressed store, hash-verified

237
238// GetSetting returns the setting by name.
239func (s *Store) GetSetting(ctx context.Context, workspace string, name storepb.SettingName) (*SettingMessage, error) {
240 if v, ok := s.settingCache.Get(getSettingCacheKey(workspace, name)); ok && s.enableCache {
241 return v, nil
242 }
243
244 settings, err := s.ListSettings(ctx, &FindSettingMessage{Workspace: workspace, Name: &name})
245 if err != nil {
246 return nil, err
247 }
248 if len(settings) == 0 {
249 return nil, nil
250 }
251 if len(settings) > 1 {
252 return nil, errors.Errorf("found multiple settings: %v", name)
253 }
254
255 return settings[0], nil
256}
257
258// ListSettings returns a list of settings.
259func (s *Store) ListSettings(ctx context.Context, find *FindSettingMessage) ([]*SettingMessage, error) {

Callers 9

GetAppIMSettingMethod · 0.95
GetSystemSettingMethod · 0.95
UpdateLicenseMethod · 0.95
GetAISettingMethod · 0.95
GetEnvironmentMethod · 0.95

Calls 4

ListSettingsMethod · 0.95
getSettingCacheKeyFunction · 0.85
GetMethod · 0.80
ErrorfMethod · 0.80

Tested by

no test coverage detected