Documentation
¶
Index ¶
- func HashFile(path string) (string, error)
- type ConvertResult
- type ConverterService
- func (s *ConverterService) CheckAvailable(ctx context.Context) error
- func (s *ConverterService) ConvertAsync(ctx context.Context, source Source, format string, baseURL string) (*ConvertResult, error)
- func (s *ConverterService) ConvertSync(ctx context.Context, source Source, format string) (*ConvertResult, error)
- func (s *ConverterService) MergeAsync(ctx context.Context, sources []Source, format string, baseURL string) (*ConvertResult, error)
- func (s *ConverterService) MergeSync(ctx context.Context, sources []Source, format string) (*ConvertResult, error)
- type Source
- type SourceType
- type TaskService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ConvertResult ¶
type ConvertResult struct {
TaskID string `json:"task_id,omitempty"`
OutputPath string `json:"output_path,omitempty"`
OutputName string `json:"output_name,omitempty"`
OutputExt string `json:"output_ext,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
}
ConvertResult 转换结果。
type ConverterService ¶
type ConverterService struct {
// contains filtered or unexported fields
}
ConverterService 转换服务。
func NewConverterService ¶
func NewConverterService(repo repository.Repository, executor libreoffice.Executor, pool *workerpool.Pool, cfg *config.Config, metricsCollector *metrics.Metrics, logger zerolog.Logger) *ConverterService
NewConverterService 创建转换服务。
func (*ConverterService) CheckAvailable ¶
func (s *ConverterService) CheckAvailable(ctx context.Context) error
CheckAvailable 检查 LibreOffice 可用性。
func (*ConverterService) ConvertAsync ¶
func (s *ConverterService) ConvertAsync(ctx context.Context, source Source, format string, baseURL string) (*ConvertResult, error)
ConvertAsync 异步转换。
func (*ConverterService) ConvertSync ¶
func (s *ConverterService) ConvertSync(ctx context.Context, source Source, format string) (*ConvertResult, error)
ConvertSync 同步转换。
func (*ConverterService) MergeAsync ¶
func (s *ConverterService) MergeAsync(ctx context.Context, sources []Source, format string, baseURL string) (*ConvertResult, error)
MergeAsync 异步合并文件。
func (*ConverterService) MergeSync ¶
func (s *ConverterService) MergeSync(ctx context.Context, sources []Source, format string) (*ConvertResult, error)
MergeSync 同步合并文件。
type Source ¶
type Source struct {
Type SourceType
FileName string
FilePath string
URL string
Size int64
}
Source 转换源。
type SourceType ¶
type SourceType string
SourceType 来源类型。
const ( // SourceTypeUpload 上传文件。 SourceTypeUpload SourceType = "upload" // SourceTypeURL URL 下载。 SourceTypeURL SourceType = "url" )
type TaskService ¶
type TaskService struct {
// contains filtered or unexported fields
}
TaskService 任务服务。
func NewTaskService ¶
func NewTaskService(repo repository.Repository, logger zerolog.Logger) *TaskService
NewTaskService 创建任务服务。
func (*TaskService) GetTask ¶
func (s *TaskService) GetTask(ctx context.Context, id string) (*repository.Task, error)
GetTask 获取任务。
Click to show internal directories.
Click to hide internal directories.