You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package model
|
|
|
|
|
|
|
|
import "github.com/jinzhu/gorm"
|
|
|
|
|
|
|
|
// Folder 目录
|
|
|
|
type Folder struct {
|
|
|
|
// 表字段
|
|
|
|
gorm.Model
|
|
|
|
Name string
|
|
|
|
ParentID uint
|
|
|
|
Position string `gorm:"size:65536"`
|
|
|
|
OwnerID uint
|
|
|
|
PositionAbsolute string `gorm:"size:65536"`
|
|
|
|
|
|
|
|
// 关联模型
|
|
|
|
OptionsSerialized PolicyOption `gorm:"-"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetFolderByPath 根据绝对路径和UID查找目录
|
|
|
|
func GetFolderByPath(path string, uid uint) (Folder, error) {
|
|
|
|
var folder Folder
|
|
|
|
result := DB.Where("owner_id = ? AND position_absolute = ?", uid, path).Find(&folder)
|
|
|
|
return folder, result.Error
|
|
|
|
}
|