108 lines
2.6 KiB
Go
108 lines
2.6 KiB
Go
// Code generated by go-enum DO NOT EDIT.
|
|
// Version: 0.9.1
|
|
// Revision: 42b1ed55945781de07471bb2db52b3f9edee19b0
|
|
// Build Date: 2025-08-02T17:25:40Z
|
|
// Built By: goreleaser
|
|
|
|
package storage
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
const (
|
|
// Local is a StorageType of type local.
|
|
Local StorageType = "local"
|
|
// Webdav is a StorageType of type webdav.
|
|
Webdav StorageType = "webdav"
|
|
// Alist is a StorageType of type alist.
|
|
Alist StorageType = "alist"
|
|
// Minio is a StorageType of type minio.
|
|
Minio StorageType = "minio"
|
|
// Telegram is a StorageType of type telegram.
|
|
Telegram StorageType = "telegram"
|
|
// S3 is a StorageType of type s3.
|
|
S3 StorageType = "s3"
|
|
)
|
|
|
|
var ErrInvalidStorageType = fmt.Errorf("not a valid StorageType, try [%s]", strings.Join(_StorageTypeNames, ", "))
|
|
|
|
var _StorageTypeNames = []string{
|
|
string(Local),
|
|
string(Webdav),
|
|
string(Alist),
|
|
string(Minio),
|
|
string(Telegram),
|
|
string(S3),
|
|
}
|
|
|
|
// StorageTypeNames returns a list of possible string values of StorageType.
|
|
func StorageTypeNames() []string {
|
|
tmp := make([]string, len(_StorageTypeNames))
|
|
copy(tmp, _StorageTypeNames)
|
|
return tmp
|
|
}
|
|
|
|
// StorageTypeValues returns a list of the values for StorageType
|
|
func StorageTypeValues() []StorageType {
|
|
return []StorageType{
|
|
Local,
|
|
Webdav,
|
|
Alist,
|
|
Minio,
|
|
Telegram,
|
|
S3,
|
|
}
|
|
}
|
|
|
|
// String implements the Stringer interface.
|
|
func (x StorageType) String() string {
|
|
return string(x)
|
|
}
|
|
|
|
// IsValid provides a quick way to determine if the typed value is
|
|
// part of the allowed enumerated values
|
|
func (x StorageType) IsValid() bool {
|
|
_, err := ParseStorageType(string(x))
|
|
return err == nil
|
|
}
|
|
|
|
var _StorageTypeValue = map[string]StorageType{
|
|
"local": Local,
|
|
"webdav": Webdav,
|
|
"alist": Alist,
|
|
"minio": Minio,
|
|
"telegram": Telegram,
|
|
"s3": S3,
|
|
}
|
|
|
|
// ParseStorageType attempts to convert a string to a StorageType.
|
|
func ParseStorageType(name string) (StorageType, error) {
|
|
if x, ok := _StorageTypeValue[name]; ok {
|
|
return x, nil
|
|
}
|
|
// Case insensitive parse, do a separate lookup to prevent unnecessary cost of lowercasing a string if we don't need to.
|
|
if x, ok := _StorageTypeValue[strings.ToLower(name)]; ok {
|
|
return x, nil
|
|
}
|
|
return StorageType(""), fmt.Errorf("%s is %w", name, ErrInvalidStorageType)
|
|
}
|
|
|
|
// Set implements the Golang flag.Value interface func.
|
|
func (x *StorageType) Set(val string) error {
|
|
v, err := ParseStorageType(val)
|
|
*x = v
|
|
return err
|
|
}
|
|
|
|
// Get implements the Golang flag.Getter interface func.
|
|
func (x *StorageType) Get() interface{} {
|
|
return *x
|
|
}
|
|
|
|
// Type implements the github.com/spf13/pFlag Value interface.
|
|
func (x *StorageType) Type() string {
|
|
return "StorageType"
|
|
}
|