Documentation ¶
Index ¶
- Variables
- func CreateFile(file *File) error
- func CreateFolder(f *Folder) error
- func CreateUser(user *User) error
- func DeleteFile(id uint64, userid int64) error
- func DeleteFolder(id uint64, userid int64) error
- func DeleteFolderRecursive(id uint64, userid int64) error
- func EditFile(file *File, userid int64) error
- func EditFolder(folder *Folder, userid int64) error
- func UpdateUser(user *User) error
- type File
- type Folder
- type FolderContent
- type Tree
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrAlreadyExists = errors.New("An entry with the same name is already there") ErrInvalidPath = errors.New("The path is invalid") ErrCannotCreateFolder = errors.New("Cannot create folder") ErrNonEmptyFolder = errors.New("The folder is not empty") )
View Source
var (
ErrUserAlreadyExists = errors.New("The user already exists")
)
Functions ¶
func CreateUser ¶
func DeleteFile ¶
func DeleteFolder ¶
func DeleteFolderRecursive ¶
func EditFolder ¶
func UpdateUser ¶
Types ¶
type File ¶
type File struct { ID uint64 `gorm:"primaryKey" json:"fileID"` Name string `gorm:"non null" json:"name"` Path string `gorm:"non null" json:"path"` ParentID uint64 `gorm:"non null" json:"parentID"` Owner int64 `gorm:"non null" json:"owner"` Header string `gorm:"non null" json:"header"` KeyEnc string `gorm:"non null" json:"key"` Nonce string `gorm:"non null" json:"nonce"` FileID string `gorm:"not null" json:"-"` }
func GetFilesInFolder ¶
type Folder ¶
type Folder struct { ID uint64 `gorm:"primaryKey" json:"folderID"` Name string `gorm:"non null" json:"name"` Path string `gorm:"non null" json:"path"` Owner int64 `gorm:"non null" json:"owner"` ParentID uint64 `json:"parentID"` }
func GetFoldersInFolder ¶
type FolderContent ¶
type FolderContent struct { Files []*File `gorm:"foreignKey:ID" json:"files"` Folder []*Folder `gorm:"foreignKey:ID" json:"folders"` }
func GetChildrenInFolder ¶
func GetChildrenInFolder(parent *Folder) (*FolderContent, error)
func (*FolderContent) Length ¶
func (f *FolderContent) Length() int
type Tree ¶
type Tree struct { Root *Folder `json:"root"` Files []*File `json:"files"` Folders []*Tree `json:"folders"` }
func GetChildrenRecursive ¶
type User ¶
type User struct { TelegramID int64 `gorm:"primaryKey" json:"userID"` ChatID int64 `gorm:"non null" json:"-"` Username string `gorm:"username" json:"username"` MasterKeySalt string `gorm:"non null" json:"masterKeySalt"` AuthenticationKey []byte `gorm:"non null" json:"-"` }
func GetUserByID ¶
func GetUserByName ¶
Click to show internal directories.
Click to hide internal directories.