Documentation ¶
Index ¶
- Variables
- func CheckFileType(fileType uploadClient.FileType) error
- func CheckFileTypeString(fileType string) error
- func DBSave(fileM *modelFile.File, subdir string, result *uploadClient.Result, ...) error
- func IsInvalidUpload(err error) bool
- func NewClient(ctx echo.Context, ownerType string, ownerID uint64, clientName string, ...) uploadClient.Client
- func NewClientWithModel(fileM *modelFile.File, clientName string, result *uploadClient.Result) uploadClient.Client
- func NewClientWithResult(ctx echo.Context, ownerType string, ownerID uint64, clientName string, ...) uploadClient.Client
- func NewModel(ctx echo.Context, ownerType string, ownerID uint64, subdir string, ...) *modelFile.File
- func NewStorer(ctx echo.Context, subdir string, storerInfos ...storerUtils.Info) (driver.Storer, error)
- type PrepareData
- func (p *PrepareData) Close() error
- func (p *PrepareData) IsInvalidUpload(err error) bool
- func (p *PrepareData) MakeCallback(fileM *modelFile.File, storer driver.Storer, subdir string) func(*uploadClient.Result, io.Reader, io.Reader) error
- func (p *PrepareData) MakeModel(ownerType string, ownerID uint64) *modelFile.File
- func (p *PrepareData) MakeUploader(ownerType string, ownerID uint64, clientName string) ...
- func (p *PrepareData) Multiple() bool
- func (p *PrepareData) NewStorer(subdir string) (driver.Storer, error)
- func (p *PrepareData) Save(fileM *modelFile.File, clientName string, clients ...uploadClient.Client) (client uploadClient.Client, err error)
- func (p *PrepareData) SetMultiple(multiple bool) *PrepareData
- func (p *PrepareData) Storer() (driver.Storer, error)
- type QuickConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidFileType = errors.New(`invalid parameter: fileType`)
View Source
var NopChecker uploadClient.Checker = func(rs *uploadClient.Result, rd io.Reader) error { return nil }
Functions ¶
func CheckFileType ¶ added in v0.6.31
func CheckFileType(fileType uploadClient.FileType) error
func CheckFileTypeString ¶ added in v0.6.31
func IsInvalidUpload ¶
func NewClientWithModel ¶
func NewClientWithModel(fileM *modelFile.File, clientName string, result *uploadClient.Result) uploadClient.Client
func NewClientWithResult ¶
func NewClientWithResult(ctx echo.Context, ownerType string, ownerID uint64, clientName string, result *uploadClient.Result) uploadClient.Client
Types ¶
type PrepareData ¶
type PrepareData struct { StorerInfo storerUtils.Info DBSaver dbsaver.DBSaver Checker uploadClient.Checker Checkin checker.Checker Subdir string FileType string // contains filtered or unexported fields }
func NoCheckTokenPrepare ¶
func NoCheckTokenPrepare(ctx echo.Context, subdir string, fileType string, storerInfos ...storerUtils.Info) (*PrepareData, error)
func Prepare ¶
func Prepare(ctx echo.Context, subdir string, fileType string, storerInfos ...storerUtils.Info) (*PrepareData, error)
Prepare 上传前的环境准备
func (*PrepareData) Close ¶
func (p *PrepareData) Close() error
func (*PrepareData) IsInvalidUpload ¶
func (p *PrepareData) IsInvalidUpload(err error) bool
func (*PrepareData) MakeCallback ¶
func (*PrepareData) MakeModel ¶
func (p *PrepareData) MakeModel(ownerType string, ownerID uint64) *modelFile.File
func (*PrepareData) MakeUploader ¶
func (p *PrepareData) MakeUploader(ownerType string, ownerID uint64, clientName string) func(fieldName string, fileType uploadClient.FileType, multiple bool) ([]*uploadClient.Result, error)
func (*PrepareData) Multiple ¶
func (p *PrepareData) Multiple() bool
func (*PrepareData) NewStorer ¶
func (p *PrepareData) NewStorer(subdir string) (driver.Storer, error)
func (*PrepareData) Save ¶
func (p *PrepareData) Save(fileM *modelFile.File, clientName string, clients ...uploadClient.Client) (client uploadClient.Client, err error)
func (*PrepareData) SetMultiple ¶
func (p *PrepareData) SetMultiple(multiple bool) *PrepareData
type QuickConfig ¶ added in v0.6.31
type QuickConfig struct { FileType string `validate:"required"` Subdir string `validate:"required"` OwnerID uint64 `validate:"required"` OwnerType string `validate:"required"` Filename string `validate:"required"` SaveFilename string // contains filtered or unexported fields }
func (QuickConfig) Result ¶ added in v0.6.32
func (qc QuickConfig) Result() *uploadClient.Result
func (*QuickConfig) Save ¶ added in v0.6.31
func (qc *QuickConfig) Save(ctx echo.Context, r io.ReadSeeker, size int64) error
Save 快存
Click to show internal directories.
Click to hide internal directories.