31 lines
646 B
Go
31 lines
646 B
Go
// Package uploader defines the interface to implement when building
|
|
// uploaders
|
|
package uploader
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
|
|
"github.com/Luzifer/go_helpers/v2/fieldcollection"
|
|
"github.com/cheggaaa/pb/v3"
|
|
)
|
|
|
|
type (
|
|
Uploader interface {
|
|
Prepare(ctx context.Context, opts UploaderOpts) error
|
|
UploadFile(ctx context.Context, opts UploaderOpts) error
|
|
ValidateConfig(config *fieldcollection.FieldCollection) error
|
|
}
|
|
|
|
UploaderOpts struct {
|
|
Name string
|
|
Config *fieldcollection.FieldCollection
|
|
|
|
Filename string
|
|
Content io.Reader
|
|
Size int64
|
|
|
|
ProgressBar *pb.ProgressBar
|
|
FinalMessage func(format string, opts ...any)
|
|
}
|
|
)
|