dao

package
v0.0.0-...-7a0ce36 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const RootId int64 = -1

Variables

This section is empty.

Functions

func CreateFile

func CreateFile(file *FileInfo, meta *FileMeta) error

func CreateFileMeta

func CreateFileMeta(meta *FileMeta) error

func CreateFolder

func CreateFolder(folder *FolderInfo) error

func InitBottle

func InitBottle(bottle *BottleMeta) error

func RemoveFile

func RemoveFile(ownerId int64, file *FileInfo) error

func RemoveFolderAndSub

func RemoveFolderAndSub(folder *FolderInfo, folders []*FolderInfo, files []*FileInfo) error

func UpdateBottle

func UpdateBottle(meta *BottleMeta) error

func UpdateFiles

func UpdateFiles(file *FileInfo) error

func UpdateFolder

func UpdateFolder(folder *FolderInfo) error

Types

type BottleMeta

type BottleMeta struct {
	db.BasicModel
	UserID   int64 `gorm:"not null"`
	Capacity int64 `gorm:"type:bigint;not null"` // b
	Remain   int64 `gorm:"type:bigint;not null"` // b
}

user store space metadata

func GetBottlesById

func GetBottlesById(id int64) (*BottleMeta, error)

func GetBottlesByUserId

func GetBottlesByUserId(uid int64) (*BottleMeta, error)

func (BottleMeta) TableName

func (BottleMeta) TableName() string

type FileInfo

type FileInfo struct {
	db.BasicModel
	Name     string   `gorm:"type:varchar(128);not null"`
	FileId   int64    `grom:"not null"`
	OwnerId  int64    `gorm:"not null"`
	FolderId int64    `gorm:"not null"`
	Size     int64    `gorm:"not null"`
	Metadata FileMeta `gorm:"foreignkey:FileId;save_associations:false;preload:false"`
}

func GetFileById

func GetFileById(ownerId, id int64) (*FileInfo, error)

func GetFileByUploadMeta

func GetFileByUploadMeta(ownerId int64, filename string, folderId int64, metaId int64) (*FileInfo, error)

func GetFilesByFolderId

func GetFilesByFolderId(ownerId, folderId int64, filterFiles []int64) ([]*FileInfo, error)

func GetFilesByFolderIds

func GetFilesByFolderIds(ownerId int64, parentIds []int64) ([]*FileInfo, error)

func (*FileInfo) FromUploadMeta

func (f *FileInfo) FromUploadMeta(meta *weed.FileUploadMeta)

func (FileInfo) TableName

func (FileInfo) TableName() string

type FileMeta

type FileMeta struct {
	db.BasicModel
	Fid           string `gorm:"type:varchar(64);not null"`
	Size          int64  `gorm:"type:bigint;not null"`
	Hash          string `gorm:"type:varchar(128);not null"`
	ChunkManifest string `gorm:"type:text;not null"`
}

func GetFileMetaByHash

func GetFileMetaByHash(hash string) (*FileMeta, error)

func GetFileMetaById

func GetFileMetaById(id int64) (*FileMeta, error)

func (*FileMeta) FromUploadMeta

func (f *FileMeta) FromUploadMeta(meta *weed.FileUploadMeta)

func (*FileMeta) GetChunkInfo

func (f *FileMeta) GetChunkInfo() (cm *weed.ChunkManifest, err error)

func (FileMeta) TableName

func (FileMeta) TableName() string

type FolderInfo

type FolderInfo struct {
	db.BasicModel
	Name     string `gorm:"type:varchar(128);not null"`
	ParentId int64  `gorm:"not null"`
	OwnerId  int64  `gorm:"not null"`
}

func GetFolderById

func GetFolderById(ownerId int64, id int64) (*FolderInfo, error)

func GetFoldersByIds

func GetFoldersByIds(ownerId int64, ids []int64) ([]*FolderInfo, error)

func GetFoldersByParentId

func GetFoldersByParentId(ownerId, parentId int64, filterFolders []int64) ([]*FolderInfo, error)

func GetFoldersByParentIds

func GetFoldersByParentIds(ownerId int64, parentIds []int64) ([]*FolderInfo, error)

func GetFoldersByPath

func GetFoldersByPath(ownerId int64, names []string, baseFolder int64, filterFolders []int64) (*FolderInfo, error)

func VirtualRoot

func VirtualRoot() *FolderInfo

func (FolderInfo) TableName

func (FolderInfo) TableName() string

Jump to

Keyboard shortcuts

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