mirror of
https://github.com/Awuqing/BackupX.git
synced 2026-09-07 16:36:42 +08:00
style(go): 统一后端代码格式
This commit is contained in:
@@ -95,4 +95,3 @@ func redirectStderr(path string) (func(), error) {
|
||||
_ = f.Close()
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -357,4 +357,3 @@ func buildStorageRegistry() *storage.Registry {
|
||||
storageRclone.RegisterAllBackends(registry)
|
||||
return registry
|
||||
}
|
||||
|
||||
|
||||
@@ -160,4 +160,3 @@ func formatFileSize(size int64) string {
|
||||
return fmt.Sprintf("%d B", size)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ type MaintenanceWindow struct {
|
||||
// 简化语法:多个窗口以 ';' 分隔,每个窗口按 "[days=xxx;]time=HH:MM-HH:MM" 格式。
|
||||
// Days 缺省 = 全周;若不合法,跳过该段而非抛错(让调用方尽力工作)。
|
||||
// 示例:
|
||||
//
|
||||
// "time=01:00-05:00" 每天 1 点到 5 点
|
||||
// "days=sat,sun;time=00:00-23:59" 仅周末全天
|
||||
// "time=22:00-06:00" 每天跨夜
|
||||
|
||||
@@ -132,4 +132,3 @@ func (s *SystemService) GetInfo(_ context.Context) *SystemInfo {
|
||||
}
|
||||
return info
|
||||
}
|
||||
|
||||
|
||||
@@ -269,7 +269,9 @@ type TencentCOSFactory struct{}
|
||||
func NewTencentCOSFactory() TencentCOSFactory { return TencentCOSFactory{} }
|
||||
|
||||
func (TencentCOSFactory) Type() storage.ProviderType { return storage.ProviderTypeTencentCOS }
|
||||
func (TencentCOSFactory) SensitiveFields() []string { return []string{"accessKeyId", "secretAccessKey"} }
|
||||
func (TencentCOSFactory) SensitiveFields() []string {
|
||||
return []string{"accessKeyId", "secretAccessKey"}
|
||||
}
|
||||
|
||||
// TencentConfig 是腾讯云 COS 的用户配置。
|
||||
type TencentConfig struct {
|
||||
@@ -355,7 +357,9 @@ type RcloneFactory struct{}
|
||||
func NewRcloneFactory() RcloneFactory { return RcloneFactory{} }
|
||||
|
||||
func (RcloneFactory) Type() storage.ProviderType { return storage.ProviderTypeRclone }
|
||||
func (RcloneFactory) SensitiveFields() []string { return []string{"pass", "password", "secret_access_key", "client_secret", "token"} }
|
||||
func (RcloneFactory) SensitiveFields() []string {
|
||||
return []string{"pass", "password", "secret_access_key", "client_secret", "token"}
|
||||
}
|
||||
|
||||
func (RcloneFactory) New(ctx context.Context, rawConfig map[string]any) (storage.StorageProvider, error) {
|
||||
backend, _ := rawConfig["backend"].(string)
|
||||
@@ -462,7 +466,9 @@ func NewBackendFactory(backendType string) GenericBackendFactory {
|
||||
return GenericBackendFactory{backendType: backendType, sensitive: sensitive}
|
||||
}
|
||||
|
||||
func (f GenericBackendFactory) Type() storage.ProviderType { return storage.ProviderType(f.backendType) }
|
||||
func (f GenericBackendFactory) Type() storage.ProviderType {
|
||||
return storage.ProviderType(f.backendType)
|
||||
}
|
||||
func (f GenericBackendFactory) SensitiveFields() []string { return f.sensitive }
|
||||
|
||||
func (f GenericBackendFactory) New(ctx context.Context, rawConfig map[string]any) (storage.StorageProvider, error) {
|
||||
|
||||
Reference in New Issue
Block a user