Documentation
¶
Index ¶
- type Preferences
- type Service
- func (s *Service) Clear() error
- func (s *Service) ClearDatadogAPIKey() error
- func (s *Service) ClearDefaultAccountID() error
- func (s *Service) ClearDefaultOrgID() error
- func (s *Service) ClearDefaultWorkspaceID() error
- func (s *Service) ClearEmail() error
- func (s *Service) ClearRole() error
- func (s *Service) ClearServices() error
- func (s *Service) GetDatadogAPIKey() string
- func (s *Service) GetDefaultAccountID() domain.AccountID
- func (s *Service) GetDefaultOrgID() domain.OrganizationID
- func (s *Service) GetDefaultOrgName() string
- func (s *Service) GetDefaultWorkspaceID() domain.WorkspaceID
- func (s *Service) GetEmail() string
- func (s *Service) GetHasSeenGreeting() bool
- func (s *Service) GetRole() string
- func (s *Service) GetServices() []string
- func (s *Service) SetDatadogAPIKey(key string) error
- func (s *Service) SetDefaultAccountID(accountID domain.AccountID) error
- func (s *Service) SetDefaultOrgID(orgID domain.OrganizationID) error
- func (s *Service) SetDefaultOrgName(orgName string) error
- func (s *Service) SetDefaultWorkspaceID(workspaceID domain.WorkspaceID) error
- func (s *Service) SetEmail(email string) error
- func (s *Service) SetHasSeenGreeting(seen bool) error
- func (s *Service) SetRole(role string) error
- func (s *Service) SetServices(services []string) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Preferences ¶
type Preferences interface {
GetEmail() string
SetEmail(email string) error
GetDatadogAPIKey() string
SetDatadogAPIKey(key string) error
GetDefaultOrgID() domain.OrganizationID
SetDefaultOrgID(orgID domain.OrganizationID) error
GetDefaultOrgName() string
SetDefaultOrgName(orgName string) error
GetDefaultAccountID() domain.AccountID
SetDefaultAccountID(accountID domain.AccountID) error
GetDefaultWorkspaceID() domain.WorkspaceID
SetDefaultWorkspaceID(workspaceID domain.WorkspaceID) error
ClearEmail() error
ClearDatadogAPIKey() error
ClearDefaultOrgID() error
ClearDefaultAccountID() error
ClearDefaultWorkspaceID() error
GetHasSeenGreeting() bool
SetHasSeenGreeting(seen bool) error
GetRole() string
SetRole(role string) error
GetServices() []string
SetServices(services []string) error
ClearRole() error
ClearServices() error
}
Preferences provides access to user preferences.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles user preferences business logic. It defines domain concepts (email, orgID, etc.) and translates them to/from generic key-value storage operations.
func NewService ¶
NewService creates a new preferences service.
func (*Service) ClearDatadogAPIKey ¶
func (*Service) ClearDefaultAccountID ¶
ClearDefaultAccountID clears the default account ID and cascades to workspace since it is account-scoped.
func (*Service) ClearDefaultOrgID ¶
ClearDefaultOrgID clears the default organization ID and cascades to account and workspace since they are org-scoped.
func (*Service) ClearDefaultWorkspaceID ¶
ClearDefaultWorkspaceID clears the default workspace ID.
func (*Service) ClearEmail ¶
func (*Service) ClearServices ¶
func (*Service) GetDatadogAPIKey ¶
func (*Service) GetDefaultAccountID ¶
func (*Service) GetDefaultOrgID ¶
func (s *Service) GetDefaultOrgID() domain.OrganizationID
func (*Service) GetDefaultOrgName ¶
func (*Service) GetDefaultWorkspaceID ¶
func (s *Service) GetDefaultWorkspaceID() domain.WorkspaceID
func (*Service) GetHasSeenGreeting ¶
func (*Service) GetServices ¶
func (*Service) SetDatadogAPIKey ¶
func (*Service) SetDefaultAccountID ¶
func (*Service) SetDefaultOrgID ¶
func (s *Service) SetDefaultOrgID(orgID domain.OrganizationID) error
func (*Service) SetDefaultOrgName ¶
func (*Service) SetDefaultWorkspaceID ¶
func (s *Service) SetDefaultWorkspaceID(workspaceID domain.WorkspaceID) error
func (*Service) SetHasSeenGreeting ¶
func (*Service) SetServices ¶
type Store ¶
type Store interface {
// Get retrieves a string value by key
Get(key string) string
// Set stores a string value by key
Set(key string, value string)
// GetBool retrieves a boolean value by key
GetBool(key string) bool
// SetBool stores a boolean value by key
SetBool(key string, value bool)
// GetList retrieves a list of strings by key
GetList(key string) []string
// SetList stores a list of strings by key
SetList(key string, values []string)
// Save persists all changes to storage
Save() error
// Clear removes all stored values
Clear() error
}
Store defines a generic key-value store with persistence. This allows services to define domain concepts while keeping the storage implementation generic. Concrete implementations: *config.Config (YAML file storage)