service

package
v0.0.0-...-b9c4ddb Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2026 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashFile

func HashFile(path string) (string, error)

HashFile 计算文件哈希。

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 获取任务。

Jump to

Keyboard shortcuts

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