Documentation ¶
Index ¶
- Variables
- func Cancel2FAById(id uint) error
- func Cancel2FAByUser(u *model.User) error
- func CreateMeta(u *model.Meta) error
- func CreateStorage(storage *model.Storage) error
- func CreateUser(u *model.User) error
- func DeleteMetaById(id uint) error
- func DeleteSettingItemByKey(key string) error
- func DeleteStorageById(id uint) error
- func DeleteUserById(id uint) error
- func GetAdmin() (*model.User, error)
- func GetEnabledStorages() ([]model.Storage, error)
- func GetGuest() (*model.User, error)
- func GetMetaById(id uint) (*model.Meta, error)
- func GetMetaByPath(path string) (*model.Meta, error)
- func GetMetas(pageIndex, pageSize int) ([]model.Meta, int64, error)
- func GetNearestMeta(path string) (*model.Meta, error)
- func GetPublicSettingItems() ([]model.SettingItem, error)
- func GetPublicSettingsMap() map[string]string
- func GetSettingItemByKey(key string) (*model.SettingItem, error)
- func GetSettingItemInKeys(keys []string) ([]model.SettingItem, error)
- func GetSettingItems() ([]model.SettingItem, error)
- func GetSettingItemsByGroup(group int) ([]model.SettingItem, error)
- func GetSettingItemsInGroups(groups []int) ([]model.SettingItem, error)
- func GetSettingsMap() map[string]string
- func GetStorageById(id uint) (*model.Storage, error)
- func GetStorages(pageIndex, pageSize int) ([]model.Storage, int64, error)
- func GetUserById(id uint) (*model.User, error)
- func GetUserByName(username string) (*model.User, error)
- func GetUsers(pageIndex, pageSize int) ([]model.User, int64, error)
- func HandleSettingItem(item *model.SettingItem) (bool, error)
- func Init(d *gorm.DB)
- func SaveSettingItem(item model.SettingItem) error
- func SaveSettingItems(items []model.SettingItem) error
- func UpdateMeta(u *model.Meta) error
- func UpdateStorage(storage *model.Storage) error
- func UpdateUser(u *model.User) error
- type SettingItemHook
Constants ¶
This section is empty.
Variables ¶
View Source
var SettingItemHooks = map[string]SettingItemHook{ conf.VideoTypes: { Hook: func(item *model.SettingItem) error { conf.TypesMap[conf.VideoTypes] = strings.Split(item.Value, ",") return nil }, }, conf.AudioTypes: { Hook: func(item *model.SettingItem) error { conf.TypesMap[conf.AudioTypes] = strings.Split(item.Value, ",") return nil }, }, conf.ImageTypes: { Hook: func(item *model.SettingItem) error { conf.TypesMap[conf.ImageTypes] = strings.Split(item.Value, ",") return nil }, }, conf.TextTypes: { Hook: func(item *model.SettingItem) error { conf.TypesMap[conf.TextTypes] = strings.Split(item.Value, ",") return nil }, }, conf.ProxyTypes: { func(item *model.SettingItem) error { conf.TypesMap[conf.ProxyTypes] = strings.Split(item.Value, ",") return nil }, }, conf.PrivacyRegs: { Hook: func(item *model.SettingItem) error { regStrs := strings.Split(item.Value, "\n") regs := make([]*regexp.Regexp, 0, len(regStrs)) for _, regStr := range regStrs { reg, err := regexp.Compile(regStr) if err != nil { return errors.WithStack(err) } regs = append(regs, reg) } conf.PrivacyReg = regs return nil }, }, }
Functions ¶
func Cancel2FAById ¶
func Cancel2FAByUser ¶
func CreateMeta ¶
func CreateStorage ¶
CreateStorage just insert storage to database
func CreateUser ¶
func DeleteMetaById ¶
func DeleteSettingItemByKey ¶
func DeleteStorageById ¶
DeleteStorageById just delete storage from database by id
func DeleteUserById ¶
func GetEnabledStorages ¶
func GetPublicSettingItems ¶
func GetPublicSettingItems() ([]model.SettingItem, error)
func GetPublicSettingsMap ¶
func GetSettingItemByKey ¶
func GetSettingItemByKey(key string) (*model.SettingItem, error)
func GetSettingItemInKeys ¶
func GetSettingItemInKeys(keys []string) ([]model.SettingItem, error)
func GetSettingItems ¶
func GetSettingItems() ([]model.SettingItem, error)
func GetSettingItemsByGroup ¶
func GetSettingItemsByGroup(group int) ([]model.SettingItem, error)
func GetSettingItemsInGroups ¶
func GetSettingItemsInGroups(groups []int) ([]model.SettingItem, error)
func GetSettingsMap ¶
func GetStorageById ¶
GetStorageById Get Storage by id, used to update storage usually
func GetStorages ¶
GetStorages Get all storages from database order by index
func HandleSettingItem ¶
func HandleSettingItem(item *model.SettingItem) (bool, error)
func SaveSettingItem ¶
func SaveSettingItem(item model.SettingItem) error
func SaveSettingItems ¶
func SaveSettingItems(items []model.SettingItem) error
func UpdateMeta ¶
func UpdateStorage ¶
UpdateStorage just update storage in database
func UpdateUser ¶
Types ¶
type SettingItemHook ¶
type SettingItemHook struct {
Hook func(item *model.SettingItem) error
}
Click to show internal directories.
Click to hide internal directories.