Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GormStore ¶
type GormStore struct {
// contains filtered or unexported fields
}
func (*GormStore) GetSettings ¶
func (*GormStore) SaveSettings ¶
type Service ¶
type Service interface { GetSettings() (*Settings, error) SaveSettings(settings *Settings) error // Pauses the system for a configured duration Pause() error // Will immediately revoke the pause timer Resume() error IsHalted() (bool, error) }
func NewService ¶
func NewService(store Store, opts ...ServiceOption) Service
type ServiceImpl ¶ added in v0.10.0
type ServiceImpl struct {
// contains filtered or unexported fields
}
func (*ServiceImpl) GetSettings ¶ added in v0.10.0
func (svc *ServiceImpl) GetSettings() (*Settings, error)
func (*ServiceImpl) IsHalted ¶ added in v0.10.0
func (svc *ServiceImpl) IsHalted() (bool, error)
func (*ServiceImpl) Pause ¶ added in v0.10.0
func (svc *ServiceImpl) Pause() error
func (*ServiceImpl) Resume ¶ added in v0.10.0
func (svc *ServiceImpl) Resume() error
func (*ServiceImpl) SaveSettings ¶ added in v0.10.0
func (svc *ServiceImpl) SaveSettings(settings *Settings) error
type ServiceOption ¶
type ServiceOption func(*ServiceImpl)
func WithPauseDuration ¶
func WithPauseDuration(duration time.Duration) ServiceOption
type Settings ¶
type Settings struct { gorm.Model MaintenanceMode bool `gorm:"column:maintenance_mode;default:false"` PausedSince sql.NullTime `gorm:"column:paused_since"` }
func (*Settings) FromJSON ¶
func (s *Settings) FromJSON(j SettingsJSON)
Update fields according to JSON version
func (*Settings) IsMaintenanceMode ¶
type SettingsJSON ¶
type SettingsJSON struct {
MaintenanceMode bool `json:"maintenanceMode"`
}
Click to show internal directories.
Click to hide internal directories.