db

package
v3.54.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2025 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate added in v3.6.0

func AutoMigrate(dst ...interface{}) error

func BatchCreateSearchNodes added in v3.6.0

func BatchCreateSearchNodes(nodes *[]model.SearchNode) error

func ClearSearchNodes added in v3.6.0

func ClearSearchNodes() error

func Close added in v3.28.0

func Close()

func CountActiveSessionsByUser added in v3.52.0

func CountActiveSessionsByUser(userID uint) (int64, error)

func CountUsersByRoleAndEnabledExclude added in v3.47.0

func CountUsersByRoleAndEnabledExclude(roleID uint, excludeUserID uint) (int64, error)

func CreateLabel added in v3.46.0

func CreateLabel(label model.Label) (uint, error)

CreateLabel just insert label to database

func CreateLabelFileBinDing added in v3.46.0

func CreateLabelFileBinDing(fileName string, labelId, userId uint) error

func CreateMeta

func CreateMeta(u *model.Meta) error

func CreateObjFile added in v3.46.0

func CreateObjFile(obj model.ObjFile) error

func CreateRole added in v3.46.0

func CreateRole(r *model.Role) error

func CreateSSHPublicKey added in v3.42.0

func CreateSSHPublicKey(k *model.SSHPublicKey) error

func CreateSearchNode added in v3.6.0

func CreateSearchNode(node *model.SearchNode) error

func CreateSession added in v3.52.0

func CreateSession(s *model.Session) error

func CreateStorage

func CreateStorage(storage *model.Storage) error

CreateStorage just insert storage to database

func CreateTaskData added in v3.37.0

func CreateTaskData(t *model.TaskItem) error

func CreateUser

func CreateUser(u *model.User) error

func DelLabelFileBinDingByFileName added in v3.46.0

func DelLabelFileBinDingByFileName(userId uint, fileName string) error

DelLabelFileBinDingByFileName used to del usually

func DelLabelFileBinDingById added in v3.46.0

func DelLabelFileBinDingById(labelId, userId uint, fileName string) error

DelLabelFileBinDingById used to del usually

func DeleteLabelById added in v3.46.0

func DeleteLabelById(id uint) error

DeleteLabelById just delete label from database by id

func DeleteMetaById

func DeleteMetaById(id uint) error

func DeleteRole added in v3.46.0

func DeleteRole(id uint) error

func DeleteSSHPublicKeyById added in v3.42.0

func DeleteSSHPublicKeyById(id uint) error

func DeleteSearchNodesByParent added in v3.6.0

func DeleteSearchNodesByParent(path string) error

func DeleteSession added in v3.52.0

func DeleteSession(userID uint, deviceKey string) error

func DeleteSessionsBefore added in v3.52.0

func DeleteSessionsBefore(ts int64) error

func DeleteSettingItemByKey

func DeleteSettingItemByKey(key string) error

func DeleteStorageById

func DeleteStorageById(id uint) error

DeleteStorageById just delete storage from database by id

func DeleteUserById

func DeleteUserById(id uint) error

func GetAllRoles added in v3.53.0

func GetAllRoles() ([]model.Role, error)

func GetAllUsers added in v3.53.0

func GetAllUsers() ([]model.User, error)

func GetDb added in v3.9.0

func GetDb() *gorm.DB

func GetEnabledStorages

func GetEnabledStorages() ([]model.Storage, error)

func GetFileByName added in v3.46.0

func GetFileByName(name string, userId uint) (objFile model.ObjFile, err error)

GetFileByName Get file by name

func GetFileByNameExists added in v3.46.0

func GetFileByNameExists(name string) bool

GetFileByNameExists Get file by name

func GetLabelBindingsByFileNamesPublic added in v3.50.0

func GetLabelBindingsByFileNamesPublic(fileNames []string) (map[string][]uint, error)

func GetLabelById added in v3.46.0

func GetLabelById(id uint) (*model.Label, error)

GetLabelById Get Label by id, used to update label usually

func GetLabelByIds added in v3.46.0

func GetLabelByIds(ids []uint) ([]model.Label, error)

GetLabelByIds Get label from database order by ids

func GetLabelByName added in v3.46.0

func GetLabelByName(name string) bool

GetLabelByName Get Label by name

func GetLabelFileBinDingByLabelId added in v3.46.0

func GetLabelFileBinDingByLabelId(labelIds []uint, userId uint) (result []model.LabelFileBinding, err error)

func GetLabelFileBinDingByLabelIdExists added in v3.46.0

func GetLabelFileBinDingByLabelIdExists(labelId, userId uint) bool

GetLabelFileBinDingByLabelIdExists Get Label by label_id, used to del label usually

func GetLabelIds added in v3.46.0

func GetLabelIds(userId uint, fileName string) ([]uint, error)

GetLabelIds Get all label_ids from database order by file_name

func GetLabels added in v3.46.0

func GetLabels(pageIndex, pageSize int) ([]model.Label, int64, error)

GetLabels Get all label from database order by id

func GetLabelsByFileNamesPublic added in v3.50.0

func GetLabelsByFileNamesPublic(fileNames []string) (map[string][]model.Label, error)

func GetMetaById

func GetMetaById(id uint) (*model.Meta, error)

func GetMetaByPath

func GetMetaByPath(path string) (*model.Meta, error)

func GetMetas

func GetMetas(pageIndex, pageSize int) (metas []model.Meta, count int64, err error)

func GetOldestActiveSession added in v3.52.0

func GetOldestActiveSession(userID uint) (*model.Session, error)

GetOldestActiveSession returns the oldest active session for the specified user.

func GetPublicSettingItems

func GetPublicSettingItems() ([]model.SettingItem, error)

func GetRole added in v3.46.0

func GetRole(id uint) (*model.Role, error)

func GetRoleByName added in v3.46.0

func GetRoleByName(name string) (*model.Role, error)

func GetRoles added in v3.46.0

func GetRoles(pageIndex, pageSize int) (roles []model.Role, count int64, err error)

func GetSSHPublicKeyById added in v3.42.0

func GetSSHPublicKeyById(id uint) (*model.SSHPublicKey, error)

func GetSSHPublicKeyByUserId added in v3.42.0

func GetSSHPublicKeyByUserId(userId uint, pageIndex, pageSize int) (keys []model.SSHPublicKey, count int64, err error)

func GetSSHPublicKeyByUserTitle added in v3.42.0

func GetSSHPublicKeyByUserTitle(userId uint, title string) (*model.SSHPublicKey, error)

func GetSSHPublicKeys added in v3.42.0

func GetSSHPublicKeys(pageIndex, pageSize int) (keys []model.SSHPublicKey, count int64, err error)

func GetSearchNodesByParent added in v3.6.0

func GetSearchNodesByParent(parent string) ([]model.SearchNode, error)

func GetSession added in v3.52.0

func GetSession(userID uint, deviceKey string) (*model.Session, error)

func GetSettingItemByKey

func GetSettingItemByKey(key 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 GetStorageById

func GetStorageById(id uint) (*model.Storage, error)

GetStorageById Get Storage by id, used to update storage usually

func GetStorageByMountPath added in v3.13.2

func GetStorageByMountPath(mountPath string) (*model.Storage, error)

GetStorageByMountPath Get Storage by mountPath, used to update storage usually

func GetStorages

func GetStorages(pageIndex, pageSize int) ([]model.Storage, int64, error)

GetStorages Get all storages from database order by index

func GetTaskDataByType added in v3.37.0

func GetTaskDataByType(type_s string) (*model.TaskItem, error)

func GetTaskDataFunc added in v3.37.0

func GetTaskDataFunc(type_s string, enabled bool) func() ([]byte, error)

func GetUserById

func GetUserById(id uint) (*model.User, error)

func GetUserByName

func GetUserByName(username string) (*model.User, error)

func GetUserByRole added in v3.7.1

func GetUserByRole(role int) (*model.User, error)

func GetUserBySSOID added in v3.13.0

func GetUserBySSOID(ssoID string) (*model.User, error)

func GetUsers

func GetUsers(pageIndex, pageSize int) (users []model.User, count int64, err error)

func GetUsersByRole added in v3.47.1

func GetUsersByRole(roleID int) ([]model.User, error)

func Init

func Init(d *gorm.DB)

func ListLabelFileBinDing added in v3.50.0

func ListLabelFileBinDing(userId uint, labelIDs []uint, fileName string, page, pageSize int) ([]model.LabelFileBinding, int64, error)

func ListSessions added in v3.52.0

func ListSessions() ([]model.Session, error)

func ListSessionsByUser added in v3.52.0

func ListSessionsByUser(userID uint) ([]model.Session, error)

func MarkInactive added in v3.52.0

func MarkInactive(sessionID string) error

func RegisterAuthn added in v3.26.0

func RegisterAuthn(u *model.User, credential *webauthn.Credential) error

func RemoveAuthn added in v3.26.0

func RemoveAuthn(u *model.User, id string) error

func RestoreLabelFileBindings added in v3.50.0

func RestoreLabelFileBindings(bindings []model.LabelFileBinding, keepIDs bool, override bool) error

func SaveSettingItem

func SaveSettingItem(item *model.SettingItem) error

func SaveSettingItems

func SaveSettingItems(items []model.SettingItem) (err error)

func SearchNode added in v3.6.0

func SearchNode(req model.SearchReq, useFullText bool) ([]model.SearchNode, int64, error)

func UpdateAuthn added in v3.26.0

func UpdateAuthn(userID uint, authn string) error

func UpdateLabel added in v3.46.0

func UpdateLabel(label *model.Label) (*model.Label, error)

UpdateLabel just update storage in database

func UpdateMeta

func UpdateMeta(u *model.Meta) error

func UpdateRole added in v3.46.0

func UpdateRole(r *model.Role) error

func UpdateRolePermissionsPathPrefix added in v3.46.0

func UpdateRolePermissionsPathPrefix(oldPath, newPath string) ([]uint, error)

func UpdateSSHPublicKey added in v3.42.0

func UpdateSSHPublicKey(k *model.SSHPublicKey) error

func UpdateSessionLastActive added in v3.52.0

func UpdateSessionLastActive(userID uint, deviceKey string, lastActive int64) error

func UpdateStorage

func UpdateStorage(storage *model.Storage) error

UpdateStorage just update storage in database

func UpdateTaskData added in v3.37.0

func UpdateTaskData(t *model.TaskItem) error

func UpdateTaskDataFunc added in v3.37.0

func UpdateTaskDataFunc(type_s string, enabled bool) func([]byte) error

func UpdateUser

func UpdateUser(u *model.User) error

func UpdateUserBasePathPrefix added in v3.46.0

func UpdateUserBasePathPrefix(oldPath, newPath string, usersOpt ...[]model.User) ([]string, error)

func UpsertSession added in v3.52.0

func UpsertSession(s *model.Session) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL