preferences

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

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

func NewService(store Store, scope log.Scope) *Service

NewService creates a new preferences service.

func (*Service) Clear

func (s *Service) Clear() error

Clear removes all preferences.

func (*Service) ClearDatadogAPIKey

func (s *Service) ClearDatadogAPIKey() error

func (*Service) ClearDefaultAccountID

func (s *Service) ClearDefaultAccountID() error

ClearDefaultAccountID clears the default account ID and cascades to workspace since it is account-scoped.

func (*Service) ClearDefaultOrgID

func (s *Service) ClearDefaultOrgID() error

ClearDefaultOrgID clears the default organization ID and cascades to account and workspace since they are org-scoped.

func (*Service) ClearDefaultWorkspaceID

func (s *Service) ClearDefaultWorkspaceID() error

ClearDefaultWorkspaceID clears the default workspace ID.

func (*Service) ClearEmail

func (s *Service) ClearEmail() error

func (*Service) ClearRole

func (s *Service) ClearRole() error

func (*Service) ClearServices

func (s *Service) ClearServices() error

func (*Service) GetDatadogAPIKey

func (s *Service) GetDatadogAPIKey() string

func (*Service) GetDefaultAccountID

func (s *Service) GetDefaultAccountID() domain.AccountID

func (*Service) GetDefaultOrgID

func (s *Service) GetDefaultOrgID() domain.OrganizationID

func (*Service) GetDefaultOrgName

func (s *Service) GetDefaultOrgName() string

func (*Service) GetDefaultWorkspaceID

func (s *Service) GetDefaultWorkspaceID() domain.WorkspaceID

func (*Service) GetEmail

func (s *Service) GetEmail() string

func (*Service) GetHasSeenGreeting

func (s *Service) GetHasSeenGreeting() bool

func (*Service) GetRole

func (s *Service) GetRole() string

func (*Service) GetServices

func (s *Service) GetServices() []string

func (*Service) SetDatadogAPIKey

func (s *Service) SetDatadogAPIKey(key string) error

func (*Service) SetDefaultAccountID

func (s *Service) SetDefaultAccountID(accountID domain.AccountID) error

func (*Service) SetDefaultOrgID

func (s *Service) SetDefaultOrgID(orgID domain.OrganizationID) error

func (*Service) SetDefaultOrgName

func (s *Service) SetDefaultOrgName(orgName string) error

func (*Service) SetDefaultWorkspaceID

func (s *Service) SetDefaultWorkspaceID(workspaceID domain.WorkspaceID) error

func (*Service) SetEmail

func (s *Service) SetEmail(email string) error

func (*Service) SetHasSeenGreeting

func (s *Service) SetHasSeenGreeting(seen bool) error

func (*Service) SetRole

func (s *Service) SetRole(role string) error

func (*Service) SetServices

func (s *Service) SetServices(services []string) error

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)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL