Documentation
¶
Overview ¶
Package model is the initial database driver and define the data structures corresponding to the tables.
Index ¶
- Variables
- func CloseDB() error
- func DeleteById[T any](id int) *gorm.DB
- func FindFirstByID[T any](id int) *T
- func FindItems[T any]() []*T
- func GetDB() *gorm.DB
- func InitDB()
- func InitSqlite()
- func Save(value interface{}) *gorm.DB
- func ToList(items []*Quick) []list.Item
- type File
- func FindFilesByDir(dir string, page int) []*File
- func FindFilesPrefixPath(path string, isDir bool) []*File
- func FindFirstByPath(path string) *File
- func FindNeedRefreshFiles(path string) []*File
- func NewFile(f *bdpan.FileInfo) *File
- func NewFiles(files []*bdpan.FileInfo) []*File
- func NewRootFile() *File
- type ORMModel
- type Pan
- type Quick
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRecordNotFound no records found ErrRecordNotFound = gorm.ErrRecordNotFound )
Functions ¶
func FindFirstByID ¶
Types ¶
type File ¶
type File struct {
*bdpan.FileInfo `gorm:"-"`
ID uint64 `gorm:"primaryKey;"`
FSID uint64 `json:"fs_id" gorm:"column:fs_id"`
Path string `json:"path"`
Dir string `json:"dir"`
Size int `json:"size"`
FileType int `json:"isdir" gorm:"column:is_dir"`
Filename string `json:"filename"`
ServerFilename string `json:"server_filename"`
Category int `json:"category"`
Dlink string `json:"dlink"`
MD5 string `json:"md5"`
ServerCTime int64 `json:"server_ctime"`
ServerMTime int64 `json:"server_mtime"`
LocalCTime int64 `json:"local_ctime"`
LocalMTime int64 `json:"local_mtime"`
// custom
IsRefresh int `json:"is_refresh"`
Level int `json:"level"`
IsSelect bool `gorm:"-" json:"is_select"` // 是否选中,tui 表格使用
ORMModel
}
生成 sqlite3 建表语句,开头加上删除语句 sqlite3 字段要符合 gorm 命名规则
func FindFilesByDir ¶
func FindFilesPrefixPath ¶
func FindFirstByPath ¶
func FindNeedRefreshFiles ¶
func NewRootFile ¶
func NewRootFile() *File
type ORMModel ¶
type Pan ¶
type Quick ¶
type Quick struct {
ID uint64 `gorm:"primaryKey;"`
Filename string `json:"filename"`
Path string `json:"path"`
Key string `json:"key"`
ORMModel
}
func (Quick) Description ¶
func (Quick) FilterValue ¶
type User ¶
type User struct {
*bdpan.GetUserInfoRes `gorm:"-"`
ID int `gorm:"primaryKey;"`
Uk int `json:"uk,omitempty"`
AvatarUrl string `json:"avatar_url,omitempty"`
BaiduName string `json:"baidu_name,omitempty"`
NetdiskName string `json:"netdisk_name,omitempty"`
VipType int32 `json:"vip_type,omitempty"`
VipName string `json:"vip_name,omitempty"`
}
func NewUser ¶
func NewUser(user *bdpan.GetUserInfoRes) *User
Click to show internal directories.
Click to hide internal directories.