Documentation
¶
Index ¶
- Variables
- func RepoGet[T any](ctx context.Context, s *Service, repoID int64, key Key, dflt T) (T, error)
- func RepoGetRequired[T any](ctx context.Context, s *Service, repoID int64, key Key) (T, error)
- func SystemGet[T any](ctx context.Context, s *Service, key Key, dflt T) (T, error)
- type Key
- type KeyValue
- type Service
- func (s *Service) Get(ctx context.Context, scope enum.SettingsScope, scopeID int64, key Key, out any) (bool, error)
- func (s *Service) Map(ctx context.Context, scope enum.SettingsScope, scopeID int64, ...) error
- func (s *Service) RepoGet(ctx context.Context, repoID int64, key Key, out any) (bool, error)
- func (s *Service) RepoMap(ctx context.Context, repoID int64, handlers ...SettingHandler) error
- func (s *Service) RepoSet(ctx context.Context, repoID int64, key Key, value any) error
- func (s *Service) RepoSetMany(ctx context.Context, repoID int64, keyValues ...KeyValue) error
- func (s *Service) Set(ctx context.Context, scope enum.SettingsScope, scopeID int64, key Key, ...) error
- func (s *Service) SetMany(ctx context.Context, scope enum.SettingsScope, scopeID int64, ...) error
- func (s *Service) SystemGet(ctx context.Context, key Key, out any) (bool, error)
- func (s *Service) SystemMap(ctx context.Context, handlers ...SettingHandler) error
- func (s *Service) SystemSet(ctx context.Context, key Key, value any) error
- func (s *Service) SystemSetMany(ctx context.Context, keyValues ...KeyValue) error
- type SettingHandler
Constants ¶
This section is empty.
Variables ¶
var ( // KeySecretScanningEnabled [bool] enables secret scanning if set to true. KeySecretScanningEnabled Key = "secret_scanning_enabled" DefaultSecretScanningEnabled = false KeyAIReviewEnabled Key = "ai_review_enabled" DefaultAIReviewEnabled = false KeyFileSizeLimit Key = "file_size_limit" DefaultFileSizeLimit = int64(5e+8) // 500MB // ContainerReadOnly [bool] disable write operates, used for gc ContainerReadOnly Key = "container_read_only" KeyInstallID Key = "install_id" DefaultInstallID = string("") )
var WireSet = wire.NewSet( ProvideService, )
Functions ¶
func RepoGetRequired ¶
RepoGetRequired is a helper method for getting a setting of a specific type for a repo. If the setting isn't found, an error is returned.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is used to enhance interaction with the settings store.
func NewService ¶
func NewService( settingsStore appstore.SettingsStore, ruleStore appstore.RuleStore, ) *Service
func ProvideService ¶
func ProvideService( settingsStore store.SettingsStore, ruleStore store.RuleStore, ) *Service
func (*Service) Get ¶
func (s *Service) Get( ctx context.Context, scope enum.SettingsScope, scopeID int64, key Key, out any, ) (bool, error)
Get returns the value of the setting with the given key for the given scope.
func (*Service) Map ¶
func (s *Service) Map( ctx context.Context, scope enum.SettingsScope, scopeID int64, handlers ...SettingHandler, ) error
Map maps all available settings using the provided handlers for the given scope.
func (*Service) RepoGet ¶
RepoGet returns the value of the setting with the given key for the given repo.
func (*Service) RepoMap ¶
RepoMap maps all available settings using the provided handlers for the given repo.
func (*Service) RepoSet ¶
RepoSet sets the value of the setting with the given key for the given repo.
func (*Service) RepoSetMany ¶
RepoSetMany sets the value of the settings with the given keys for the given repo.
func (*Service) Set ¶
func (s *Service) Set( ctx context.Context, scope enum.SettingsScope, scopeID int64, key Key, value any, ) error
Set sets the value of the setting with the given key for the given scope.
func (*Service) SetMany ¶
func (s *Service) SetMany( ctx context.Context, scope enum.SettingsScope, scopeID int64, keyValues ...KeyValue, ) error
SetMany sets the value of the settings with the given keys for the given scope.
func (*Service) SystemGet ¶
SystemGet returns the value of the setting with the given key for the system.
func (*Service) SystemMap ¶
func (s *Service) SystemMap( ctx context.Context, handlers ...SettingHandler, ) error
SystemMap maps all available settings using the provided handlers for the system.
type SettingHandler ¶
type SettingHandler interface {
Key() Key
Required() bool
Handle(ctx context.Context, raw []byte) error
}
SettingHandler is an abstraction of a component that's handling a single setting value as part of calling service.Map.
func Mapping ¶
func Mapping[T any](key Key, target *T) SettingHandler
Mapping returns a SettingHandler that maps the value of the setting with the given key to the target.
func MappingRequired ¶
func MappingRequired[T any](key Key, target *T) SettingHandler
MappingRequired returns a SettingHandler that maps the value of the setting with the given key to the target. If the setting wasn't found an error is returned.