Documentation
¶
Index ¶
- type OrgPreferences
- type OrgService
- func (s *OrgService) Clear() error
- func (s *OrgService) ClearDefaultAccountID() error
- func (s *OrgService) ClearDefaultWorkspaceID() error
- func (s *OrgService) GetDefaultAccountID() domain.AccountID
- func (s *OrgService) GetDefaultWorkspaceID() domain.WorkspaceID
- func (s *OrgService) SetDefaultAccountID(accountID domain.AccountID) error
- func (s *OrgService) SetDefaultWorkspaceID(workspaceID domain.WorkspaceID) error
- type Store
- type Theme
- type UserPreferences
- type UserService
- func (s *UserService) Clear() error
- func (s *UserService) GetActiveOrgID() domain.OrganizationID
- func (s *UserService) GetRole() string
- func (s *UserService) GetTheme() Theme
- func (s *UserService) SetActiveOrgID(orgID domain.OrganizationID) error
- func (s *UserService) SetRole(role string) error
- func (s *UserService) SetTheme(theme Theme) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrgPreferences ¶ added in v1.11.0
type OrgPreferences interface {
GetDefaultAccountID() domain.AccountID
SetDefaultAccountID(accountID domain.AccountID) error
GetDefaultWorkspaceID() domain.WorkspaceID
SetDefaultWorkspaceID(workspaceID domain.WorkspaceID) error
ClearDefaultAccountID() error
ClearDefaultWorkspaceID() error
Clear() error
}
OrgPreferences provides access to org-scoped preferences. These are swapped when the user switches organizations.
type OrgService ¶ added in v1.11.0
type OrgService struct {
// contains filtered or unexported fields
}
OrgService implements OrgPreferences backed by an org-level Store.
func NewOrgService ¶ added in v1.11.0
func NewOrgService(store Store, scope log.Scope) *OrgService
NewOrgService creates a new org preferences service.
func (*OrgService) Clear ¶ added in v1.11.0
func (s *OrgService) Clear() error
func (*OrgService) ClearDefaultAccountID ¶ added in v1.11.0
func (s *OrgService) ClearDefaultAccountID() error
ClearDefaultAccountID clears the default account and cascades to workspace.
func (*OrgService) ClearDefaultWorkspaceID ¶ added in v1.11.0
func (s *OrgService) ClearDefaultWorkspaceID() error
func (*OrgService) GetDefaultAccountID ¶ added in v1.11.0
func (s *OrgService) GetDefaultAccountID() domain.AccountID
func (*OrgService) GetDefaultWorkspaceID ¶ added in v1.11.0
func (s *OrgService) GetDefaultWorkspaceID() domain.WorkspaceID
func (*OrgService) SetDefaultAccountID ¶ added in v1.11.0
func (s *OrgService) SetDefaultAccountID(accountID domain.AccountID) error
func (*OrgService) SetDefaultWorkspaceID ¶ added in v1.11.0
func (s *OrgService) SetDefaultWorkspaceID(workspaceID domain.WorkspaceID) 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)
type UserPreferences ¶ added in v1.11.0
type UserPreferences interface {
GetTheme() Theme
SetTheme(theme Theme) error
GetActiveOrgID() domain.OrganizationID
SetActiveOrgID(orgID domain.OrganizationID) error
GetRole() string
SetRole(role string) error
Clear() error
}
UserPreferences provides access to env-level user preferences. These persist across org switches.
type UserService ¶ added in v1.11.0
type UserService struct {
// contains filtered or unexported fields
}
UserService implements UserPreferences backed by an env-level Store.
func NewUserService ¶ added in v1.11.0
func NewUserService(store Store, scope log.Scope) *UserService
NewUserService creates a new user preferences service.
func (*UserService) Clear ¶ added in v1.11.0
func (s *UserService) Clear() error
func (*UserService) GetActiveOrgID ¶ added in v1.11.0
func (s *UserService) GetActiveOrgID() domain.OrganizationID
func (*UserService) GetRole ¶ added in v1.11.0
func (s *UserService) GetRole() string
func (*UserService) GetTheme ¶ added in v1.11.0
func (s *UserService) GetTheme() Theme
func (*UserService) SetActiveOrgID ¶ added in v1.11.0
func (s *UserService) SetActiveOrgID(orgID domain.OrganizationID) error
func (*UserService) SetRole ¶ added in v1.11.0
func (s *UserService) SetRole(role string) error
func (*UserService) SetTheme ¶ added in v1.11.0
func (s *UserService) SetTheme(theme Theme) error