Documentation
¶
Index ¶
Constants ¶
View Source
const ( TaskStatusRunning = iota TaskStatusSucceeded TaskStatusFailed )
Variables ¶
This section is empty.
Functions ¶
func ToCsv ¶
func ToCsv(ctx context.Context, fsg FieldsSeparatorGetter, dataCursor DataCursor, dir string) (resFileName string, resErr error)
ToCsv fetches data and saves it in csv file.
Types ¶
type DataCursor ¶
type DataCursor interface { Next(ctx context.Context) bool Scan(*map[string]any) error Close(ctx context.Context) error }
func NewMongoCursor ¶
type Field ¶
type FieldsSeparatorGetter ¶
type OutputFormatter ¶
type OutputFormatter interface { GetFileExtension() string DataFetcher(context.Context, FieldsSeparatorGetter, DataCursor) (string, error) }
type Task ¶
type Task struct { ID string `bson:"_id"` Status int64 `bson:"status"` Type string `bson:"type"` Parameters string `bson:"parameters"` Fields Fields `bson:"fields"` Separator rune `bson:"separator"` File string `bson:"file,omitempty"` Filename string `bson:"filename"` FailReason string `bson:"fail_reason,omitempty"` User string `bson:"user"` Created datetime.CpsTime `bson:"created"` Launched *datetime.CpsTime `bson:"launched,omitempty"` Completed *datetime.CpsTime `bson:"completed,omitempty"` }
type TaskCreator ¶
type TaskCreator interface { Create(ctx context.Context, t TaskParameters) (*Task, error) Get(ctx context.Context, id string) (*Task, error) SetFormatter(t string, f OutputFormatter) GetFormatter(t string) OutputFormatter }
TaskCreator is used to create export task.
type TaskExecutor ¶
type TaskExecutor interface { TaskCreator RegisterType(t string, fetch FetchData) ExecuteTask(ctx context.Context, id string) error ProcessAbandonedTasks(ctx context.Context) DeleteOldTasks(ctx context.Context) }
func NewTaskExecutor ¶
func NewTaskExecutor( client mongo.DbClient, jobPublisher workers.JobPublisher, timezoneConfigProvider config.TimezoneConfigProvider, dir string, logger zerolog.Logger, ) TaskExecutor
Source Files
¶
- csv.go
- cursor.go
- models.go
- task_executor.go
Click to show internal directories.
Click to hide internal directories.