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)
- 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
- 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 KeyFileSizeLimit Key = "file_size_limit" DefaultFileSizeLimit = int64(1e+8) // 100 MB )
var WireSet = wire.NewSet( ProvideService, )
Functions ¶
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, ) *Service
func ProvideService ¶
func ProvideService( settingsStore store.SettingsStore, ) *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.
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.