file

package
v1.0.17 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATUS_PROGRESS  = "PROGRESS"
	STATUS_COMPLETED = "COMPLETED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DirectoryLimit added in v1.0.11

type DirectoryLimit struct {
	DirectoryId uint32   `json:"directoryId"`
	Accepts     []string `json:"accepts"`
	MaxSize     uint32   `json:"maxSize"`
}

type File

type File struct {
	Id          uint32 `json:"id"`
	DirectoryId uint32 `json:"directoryId"`
	Name        string `json:"name"`
	Type        string `json:"type"`
	Size        uint32 `json:"size"`
	Sha         string `json:"sha"`
	Key         string `json:"key"`
	Src         string `json:"src"`
	URL         string `json:"url"`
	Status      string `json:"status"`
	UploadId    string `json:"uploadId"`
	ChunkCount  uint32 `json:"chunkCount"`
	CreatedAt   int64  `json:"createdAt"`
	UpdatedAt   int64  `json:"updatedAt"`
}

type GetFileRequest

type GetFileRequest struct {
	Id  *uint32 `json:"id"`
	Sha *string `json:"sha"`
	Src *string `json:"src"`
}

type ListFileRequest added in v1.0.11

type ListFileRequest struct {
	Page        uint32  `json:"page"`
	PageSize    uint32  `json:"pageSize"`
	Order       *string `json:"order"`
	OrderBy     *string `json:"orderBy"`
	DirectoryId *uint32 `json:"directoryId"`
	Status      *string `json:"status"`
	Name        *string `json:"name"`
}

type PrepareUploadFileReply

type PrepareUploadFileReply struct {
	Uploaded     bool     `json:"uploaded"`
	Src          *string  `json:"src"`
	ChunkSize    *uint32  `json:"chunkSize"`
	ChunkCount   *uint32  `json:"chunkCount"`
	UploadId     *string  `json:"uploadId"`
	UploadChunks []uint32 `json:"uploadChunks"`
	Sha          *string  `json:"sha"`
	URL          *string  `json:"url"`
}

type PrepareUploadFileRequest

type PrepareUploadFileRequest struct {
	DirectoryId   *uint32 `json:"directoryId"`
	DirectoryPath *string `json:"directoryPath"`
	Name          string  `json:"name"`
	Size          uint32  `json:"size"`
	Sha           string  `json:"sha"`
}

type Repo

type Repo interface {
	// GetFile 获取指定的文件信息
	GetFile(ctx kratosx.Context, id uint32) (*File, error)

	// GetFileBySha 获取指定的文件信息
	GetFileBySha(ctx kratosx.Context, sha string) (*File, error)

	// GetFileByUploadId 获取指定的文件信息
	GetFileByUploadId(ctx kratosx.Context, uid string) (*File, error)

	// GetFileBySrc 获取指定的文件信息
	GetFileBySrc(ctx kratosx.Context, src string) (*File, error)

	// ListFile 获取文件信息列表
	ListFile(ctx kratosx.Context, req *ListFileRequest) ([]*File, uint32, error)

	// CreateFile 创建文件信息
	CreateFile(ctx kratosx.Context, req *File) (uint32, error)

	// CopyFile 复制文件信息
	CopyFile(ctx kratosx.Context, src *File, directoryId uint32, fileName string) error

	// UpdateFile 更新文件信息
	UpdateFile(ctx kratosx.Context, req *File) error

	// UpdateFileStatus 更新文	件状态
	UpdateFileStatus(ctx kratosx.Context, id uint32, status string) error

	// DeleteFile 删除文件信息
	DeleteFile(ctx kratosx.Context, ids []uint32) (uint32, error)

	// GetDirectoryLimitByPath 获取指定的path上传限制信息
	GetDirectoryLimitByPath(ctx kratosx.Context, paths []string) (*DirectoryLimit, error)

	// GetDirectoryLimitById 获取指定的id上传限制信息
	GetDirectoryLimitById(ctx kratosx.Context, id uint32) (*DirectoryLimit, error)

	// GetStore 获取上传器
	GetStore() store.Store
}

type UploadFileReply

type UploadFileReply struct {
	Src string `json:"src"`
	Sha string `json:"sha"`
	URL string `json:"url"`
}

type UploadFileRequest

type UploadFileRequest struct {
	Data     []byte `json:"data"`
	UploadId string `json:"uploadId"`
	Index    uint32 `json:"index"`
}

type UseCase

type UseCase struct {
	// contains filtered or unexported fields
}

func NewUseCase

func NewUseCase(config *conf.Config, repo Repo) *UseCase

func (*UseCase) DeleteFile added in v1.0.11

func (u *UseCase) DeleteFile(ctx kratosx.Context, ids []uint32) (uint32, error)

DeleteFile 删除文件信息

func (*UseCase) GetFile

func (u *UseCase) GetFile(ctx kratosx.Context, req *GetFileRequest) (*File, error)

GetFile 获取指定的文件信息

func (*UseCase) ListFile added in v1.0.11

func (u *UseCase) ListFile(ctx kratosx.Context, req *ListFileRequest) ([]*File, uint32, error)

ListFile 获取文件信息列表

func (*UseCase) PrepareUploadFile

func (u *UseCase) PrepareUploadFile(ctx kratosx.Context, req *PrepareUploadFileRequest) (*PrepareUploadFileReply, error)

PrepareUploadFile 预上传文件信息

func (*UseCase) UpdateFile

func (u *UseCase) UpdateFile(ctx kratosx.Context, req *File) error

UpdateFile 更新文件信息

func (*UseCase) UploadFile

func (u *UseCase) UploadFile(ctx kratosx.Context, req *UploadFileRequest) (*UploadFileReply, error)

UploadFile 上传文件信息

func (*UseCase) VerifyURL added in v1.0.11

func (u *UseCase) VerifyURL(key string, expire string, sign string) error

VerifyURL 验证访问url

Jump to

Keyboard shortcuts

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