importer

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Importer

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

Importer manages background import jobs.

func New

func New(opts Opts) *Importer

New creates and returns a new instance of the Importer.

func (*Importer) AddLog

func (i *Importer) AddLog(namespace, message string)

AddLog appends a log message to the job status.

func (*Importer) Close

func (i *Importer) Close()

Close gracefully shuts down the importer.

func (*Importer) GetStatus

func (i *Importer) GetStatus(namespace string) (*Job, error)

GetStatus returns the status of an import job.

func (*Importer) Submit

func (i *Importer) Submit(namespace string, fn func() error) error

Submit submits a new import job for execution.

func (*Importer) UpdateCounts

func (i *Importer) UpdateCounts(namespace string, total, success, errors int)

UpdateCounts updates the success/error counts and total.

type Job

type Job struct {
	Running   bool      `json:"running"`
	Logs      []string  `json:"logs"`
	Total     int       `json:"total"`
	Success   int       `json:"success"`
	Errors    int       `json:"errors"`
	StartedAt time.Time `json:"started_at"`
	EndedAt   time.Time `json:"ended_at"`
}

Job represents the status of an import job.

type Opts

type Opts struct {
	Lo   *logf.Logger
	I18n *i18n.I18n
}

Opts contains options for initializing the Importer.

Jump to

Keyboard shortcuts

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