taskstore

package module
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: AGPL-3.0 Imports: 18 Imported by: 0

README

Task Store Open in Gitpod

Tests Status Go Report Card PkgGoDev

TaskStore is a robust, asynchronous durable task queue package designed to offload time-consuming or resource-intensive operations from your main application.

By deferring tasks to the background, you can improve application responsiveness and prevent performance bottlenecks.

TaskStore leverages a durable database (SQLite, MySQL, or PostgreSQL) to ensure reliable persistence and fault tolerance.

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). You can find a copy of the license at https://www.gnu.org/licenses/agpl-3.0.en.html

For commercial use, please use my contact page to obtain a commercial license.

Installation

go get github.com/gouniverse/taskstore

Setup

myTaskStore = taskstore.NewStore(taskstore.NewStoreOptions{
	DB:                 databaseInstance,
    TaskTableName:      "my_task"
	QueueTableName:     "my_queue",
	AutomigrateEnabled: true,
	DebugEnabled:       false,
})

Tasks

The task specifies a unit of work to be completed. It can be performed immediately, or enqueued to the database and deferreed for asynchronious processing, ensuring your application remains responsive.

Each task is uniquely identified by an alias and provides a human-readable title and description.

Each task is uniquely identified by an alias that allows the task to be easily called. A human-readable title and description to give the user more information on the task.

To define a task, implement the TaskHandlerInterface and provide a Handle method that contains the task's logic.

Optionally, extend the TaskHandlerBase struct for additional features like parameter retrieval.

Tasks can be executed directly from the command line (CLI) or as part of a background queue.

The tasks placed in the queue will be processed at specified interval.

package tasks

func NewHelloWorldTask() *HelloWorldTask {
	return &HelloWorldTask{}
}

type HelloWorldTask struct {
	taskstore.TaskHandlerBase
}

var _ taskstore.TaskHandlerInterface = (*HelloWorldTask)(nil) // verify it extends the task handler interface

func (task *HelloWorldTask) Alias() string {
	return "HelloWorldTask"
}

func (task *HelloWorldTask) Title() string {
	return "Hello World"
}

func (task *HelloWorldTask) Description() string {
	return "Say hello world"
}

// Enqueue. Optional shortcut to quickly add this task to the queue
func (task *HelloWorldTask) Enqueue(name string) (task *taskstore.Queue, err error) {
	return myTaskStore.TaskEnqueueByAlias(task.Alias(), map[string]any{
		"name": name,
	})
}

func (task *HelloWorldTask) Handle() bool {
	name := handler.GetParam("name")

        // Optional to allow adding the task to the queue manually. Useful while in development
	if !task.HasQueuedTask() && task.GetParam("enqueue") == "yes" {
		_, err := handler.Enqueue(name)

		if err != nil {
			task.LogError("Error enqueuing task: " + err.Error())
		} else {
			task.LogSuccess("Task enqueued.")
		}
		
		return true
	}

        if name != "" {
		task.LogInfo("Hello" + name + "!")	
	} else {
		task.LogInfo("Hello World!")
	}

	return true
}

Registering the Tasks to the TaskStore

Registering the task to the task store will persist it in the database.

myTaskStore.TaskHandlerAdd(NewHelloWorldTask(), true)

Executing Tasks in the Terminal

To add the option to execute tasks from the terminal add the following to your main method

myTaskStore.TaskExecuteCli(args[1], args[1:])

Example:

go run . HelloWorldTask --name="Tom Jones"

Adding the Task to the Queue

To add a task to the background queue

myTaskStore.TaskEnqueueByAlias(NewHelloWorldTask.Alias(), map[string]any{
	"name": name,
})

Or if you have defined an Enqueue method as in the example task above.

NewHelloWorldTask().Enqueue("Tom Jones")

Starting the Queue

To start the queue call the QueueRunGoroutine. It allows you to specify the interval for processing the queued tasks (i.e. every 10 seconds) Also to set timeout for queued tasks. After a queued task is started if it has not completed in the specified timeout it will be marked as failed, and the rest of he tasks will start to be processed.

myTaskStore.QueueRunGoroutine(10, 2) // every 10s, unstuck after 2 mins

Store Methods

  • AutoMigrate() error - automigrate (creates) the task and queue table
  • EnableDebug(debug bool) - enables / disables the debug option

Task Methods

  • TaskCreate(Task *Task) (bool, error) - creates a Task
  • TaskEnqueueByAlias(taskAlias string, parameters map[string]interface{}) (*Queue, error) - finds a task by its alias and appends it to the queue
  • TaskList(options map[string]string) ([]Task, error) - lists tasks
  • TaskFindByAlias(alias string) *Task - finds a Task by alias
  • TaskFindByID(id string) *Task - finds a task by ID
  • TaskUpdate(Task *Task) bool - updates a task

Queue Methods

  • QueueCreate(queue *Queue) error - creates a new queued task
  • QueueDeleteByID(id string) *Queue - deleted a queued task by ID
  • QueueFindByID(id string) *Queue - finds a queued task by ID
  • QueueFail(queue *Queue) error - fails a queued task
  • QueueSoftDeleteByID(id string) *Queue - soft delete a queued task by ID (populates the deleted_at field)
  • QueueSuccess(queue *Queue) error - completes a queued task successfully
  • QueueList(options QueueListOptions) ([]Queue, error) - lists the queued tasks
  • QueueUpdate(queue *Queue) error - updates a queued task
  • Queue > GetParameters() (map[string]interface{}, error) - gets the parameters of the queued task
  • Queue > AppendDetails(details string) - appends details to the queued task

Frequently Asked Questions (FAQ)

1. What is TaskStore used for?

TaskStore is a versatile tool for offloading time-consuming or resource-intensive tasks from your main application. By deferring these tasks to the background, you can improve application responsiveness and prevent performance bottlenecks.

It's ideal for tasks like data processing, sending emails, generating reports, or performing batch operations.

2. How does TaskStore work?

TaskStore creates a durable queue in your database (SQLite, MySQL, or PostgreSQL) to store tasks. These tasks are then processed asynchronously by a background worker. You can define tasks using a simple interface and schedule them to be executed at specific intervals or on demand.

3. What are the benefits of using TaskStore?
  • Improved application performance: Offload time-consuming tasks to prevent performance bottlenecks.
  • Asynchronous processing: Execute tasks independently of your main application flow.
  • Reliability: Ensure tasks are completed even if your application crashes.
  • Flexibility: Schedule tasks to run at specific intervals or on demand.
  • Ease of use: Define tasks using a simple interface and integrate with your existing application.
4. How do I create a task in TaskStore?

To create a task, you'll need to implement the TaskHandlerInterface and provide a Handle method that contains the task's logic. You can also extend the TaskHandlerBase struct for additional features.

5. How do I schedule a task to run in the background?

Use the TaskEnqueueByAlias method to add a task to the background queue. You can specify the interval at which the queue is processed using the QueueRunGoroutine method.

6. Can I monitor the status of tasks?

Yes, TaskStore provides methods to list tasks, check their status, and view task details.

7. How does TaskStore handle task failures?

If a task fails, it can be retried automatically or marked as failed. You can customize the retry logic to suit your specific needs.

8. Is TaskStore suitable for large-scale applications?

Yes, TaskStore is designed to handle large volumes of tasks. It can be scaled horizontally by adding more worker processes.

9. Does TaskStore support different database systems?

Yes, TaskStore supports SQLite, MySQL, and PostgreSQL.

10. Can I customize TaskStore to fit my specific needs?

Yes, TaskStore is highly customizable. You can extend and modify the code to suit your requirements.

Similar

Documentation

Index

Constants

View Source
const ASC = "asc"
View Source
const COLUMN_ALIAS = "alias"
View Source
const COLUMN_ATTEMPTS = "attempts"
View Source
const COLUMN_COMPLETED_AT = "completed_at"
View Source
const COLUMN_CREATED_AT = "created_at"
View Source
const COLUMN_DELETED_AT = "deleted_at"
View Source
const COLUMN_DESCRIPTION = "description"
View Source
const COLUMN_DETAILS = "details"
View Source
const COLUMN_ID = "id"
View Source
const COLUMN_MEMO = "memo"
View Source
const COLUMN_METAS = "metas"
View Source
const COLUMN_OUTPUT = "output"
View Source
const COLUMN_PARAMETERS = "parameters"
View Source
const COLUMN_STARTED_AT = "started_at"
View Source
const COLUMN_STATUS = "status"
View Source
const COLUMN_TASK_ID = "task_id"
View Source
const COLUMN_TITLE = "title"
View Source
const COLUMN_UPDATED_AT = "updated_at"
View Source
const DESC = "desc"
View Source
const QueueStatusCanceled = "canceled"
View Source
const QueueStatusDeleted = "deleted"
View Source
const QueueStatusFailed = "failed"
View Source
const QueueStatusPaused = "paused"
View Source
const QueueStatusQueued = "queued"
View Source
const QueueStatusRunning = "running"
View Source
const QueueStatusSuccess = "success"
View Source
const TaskStatusActive = "active"
View Source
const TaskStatusCanceled = "canceled"

Variables

This section is empty.

Functions

func NextRunAt added in v1.3.0

func NextRunAt(rule RecurrenceRule, now *carbon.Carbon) (*carbon.Carbon, error)

Types

type DayOfWeek added in v1.3.0

type DayOfWeek string
const (
	DayOfWeekMonday    DayOfWeek = "monday"
	DayOfWeekTuesday   DayOfWeek = "tuesday"
	DayOfWeekWednesday DayOfWeek = "wednesday"
	DayOfWeekThursday  DayOfWeek = "thursday"
	DayOfWeekFriday    DayOfWeek = "friday"
	DayOfWeekSaturday  DayOfWeek = "saturday"
	DayOfWeekSunday    DayOfWeek = "sunday"
)

type Frequency added in v1.3.0

type Frequency string

Define a string type alias

const (
	FrequencyNone     Frequency = "none"
	FrequencySecondly Frequency = "secondly"
	FrequencyMinutely Frequency = "minutely"
	FrequencyHourly   Frequency = "hourly"
	FrequencyDaily    Frequency = "daily"
	FrequencyWeekly   Frequency = "weekly"
	FrequencyMonthly  Frequency = "monthly"
	FrequencyYearly   Frequency = "yearly"
)

Define the constants as strings

type MonthOfYear added in v1.3.0

type MonthOfYear string
const (
	MonthOfYearJanuary   MonthOfYear = "JANUARY"
	MonthOfYearFebruary  MonthOfYear = "FEBRUARY"
	MonthOfYearMarch     MonthOfYear = "MARCH"
	MonthOfYearApril     MonthOfYear = "APRIL"
	MonthOfYearMay       MonthOfYear = "MAY"
	MonthOfYearJune      MonthOfYear = "JUNE"
	MonthOfYearJuly      MonthOfYear = "JULY"
	MonthOfYearAugust    MonthOfYear = "AUGUST"
	MonthOfYearSeptember MonthOfYear = "SEPTEMBER"
	MonthOfYearOctober   MonthOfYear = "OCTOBER"
	MonthOfYearNovember  MonthOfYear = "NOVEMBER"
	MonthOfYearDecember  MonthOfYear = "DECEMBER"
)

type NewStoreOptions added in v0.0.6

type NewStoreOptions struct {
	TaskTableName      string
	QueueTableName     string
	DB                 *sql.DB
	DbDriverName       string
	AutomigrateEnabled bool
	DebugEnabled       bool
}

NewStoreOptions define the options for creating a new task store

type QueueInterface added in v1.1.0

type QueueInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	IsCanceled() bool
	IsDeleted() bool
	IsFailed() bool
	IsQueued() bool
	IsPaused() bool
	IsRunning() bool
	IsSuccess() bool
	IsSoftDeleted() bool

	Attempts() int
	SetAttempts(attempts int) QueueInterface

	CompletedAt() string
	CompletedAtCarbon() *carbon.Carbon
	SetCompletedAt(completedAt string) QueueInterface

	CreatedAt() string
	CreatedAtCarbon() *carbon.Carbon
	SetCreatedAt(createdAt string) QueueInterface

	Details() string
	AppendDetails(details string) QueueInterface
	SetDetails(details string) QueueInterface

	ID() string
	SetID(id string) QueueInterface

	Output() string
	SetOutput(output string) QueueInterface

	Parameters() string
	SetParameters(parameters string) QueueInterface
	ParametersMap() (map[string]string, error)
	SetParametersMap(parameters map[string]string) (QueueInterface, error)

	SoftDeletedAt() string
	SoftDeletedAtCarbon() *carbon.Carbon
	SetSoftDeletedAt(deletedAt string) QueueInterface

	StartedAt() string
	StartedAtCarbon() *carbon.Carbon
	SetStartedAt(startedAt string) QueueInterface

	Status() string
	SetStatus(status string) QueueInterface

	TaskID() string
	SetTaskID(taskID string) QueueInterface

	UpdatedAt() string
	UpdatedAtCarbon() *carbon.Carbon
	SetUpdatedAt(updatedAt string) QueueInterface
}

func NewQueue added in v1.1.0

func NewQueue() QueueInterface

func NewQueueFromExistingData added in v1.1.0

func NewQueueFromExistingData(data map[string]string) QueueInterface

type QueueQueryInterface added in v1.1.0

type QueueQueryInterface interface {
	Validate() error

	Columns() []string
	SetColumns(columns []string) QueueQueryInterface

	HasCountOnly() bool
	IsCountOnly() bool
	SetCountOnly(countOnly bool) QueueQueryInterface

	HasCreatedAtGte() bool
	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) QueueQueryInterface

	HasCreatedAtLte() bool
	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) QueueQueryInterface

	HasID() bool
	ID() string
	SetID(id string) QueueQueryInterface

	HasIDIn() bool
	IDIn() []string
	SetIDIn(idIn []string) QueueQueryInterface

	HasLimit() bool
	Limit() int
	SetLimit(limit int) QueueQueryInterface

	HasOffset() bool
	Offset() int
	SetOffset(offset int) QueueQueryInterface

	HasSortOrder() bool
	SortOrder() string
	SetSortOrder(sortOrder string) QueueQueryInterface

	HasOrderBy() bool
	OrderBy() string
	SetOrderBy(orderBy string) QueueQueryInterface

	HasSoftDeletedIncluded() bool
	SoftDeletedIncluded() bool
	SetSoftDeletedIncluded(withDeleted bool) QueueQueryInterface

	HasStatus() bool
	Status() string
	SetStatus(status string) QueueQueryInterface

	HasStatusIn() bool
	StatusIn() []string
	SetStatusIn(statusIn []string) QueueQueryInterface

	HasTaskID() bool
	TaskID() string
	SetTaskID(taskID string) QueueQueryInterface
}

func QueueQuery added in v1.1.0

func QueueQuery() QueueQueryInterface

type RecurrenceRule added in v1.3.0

type RecurrenceRule interface {
	GetFrequency() Frequency
	SetFrequency(Frequency) RecurrenceRule

	GetStartsAt() string
	SetStartsAt(dateTimeUTC string) RecurrenceRule

	GetEndsAt() string
	SetEndsAt(dateTimeUTC string) RecurrenceRule

	GetInterval() int
	SetInterval(int) RecurrenceRule

	GetDaysOfWeek() []DayOfWeek
	SetDaysOfWeek([]DayOfWeek) RecurrenceRule

	GetDaysOfMonth() []int
	SetDaysOfMonth([]int) RecurrenceRule

	GetMonthsOfYear() []MonthOfYear
	SetMonthsOfYear([]MonthOfYear) RecurrenceRule
}

func NewRecurrenceRule added in v1.3.0

func NewRecurrenceRule() RecurrenceRule

type ScheduleDefinition added in v1.3.0

type ScheduleDefinition interface {
	GetID() string
	SetID(string) ScheduleDefinition

	GetRecurrenceRule() string
	SetRecurrenceRule(dateTimeUtc string) ScheduleDefinition

	GetStartsAt() string
	SetStartsAt(dateTimeUtc string)

	GetEndsAt() string
	SetEndsAt(string)

	IsValid() bool
	GetNextRunTime(string) (string, error)
}

type ScheduleInterface added in v1.3.0

type ScheduleInterface interface {
	ScheduleDefinitionID() string
	SetScheduleDefinition(ScheduleDefinition)
}

type Store

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

Store defines a session store

func NewStore

func NewStore(opts NewStoreOptions) (*Store, error)

NewStore creates a new task store

func (*Store) AutoMigrate

func (st *Store) AutoMigrate() error

AutoMigrate migrates the tables

func (*Store) EnableDebug

func (st *Store) EnableDebug(debugEnabled bool) StoreInterface

EnableDebug - enables the debug option

func (*Store) QueueCount added in v0.4.0

func (store *Store) QueueCount(options QueueQueryInterface) (int64, error)

func (*Store) QueueCreate added in v0.0.6

func (store *Store) QueueCreate(queue QueueInterface) error

QueueCreate creates a queued task

func (*Store) QueueDelete added in v1.1.0

func (store *Store) QueueDelete(queue QueueInterface) error

func (*Store) QueueDeleteByID added in v0.6.0

func (st *Store) QueueDeleteByID(id string) error

func (*Store) QueueFail added in v0.0.6

func (st *Store) QueueFail(queue QueueInterface) error

QueueFail fails a queued task

func (*Store) QueueFindByID added in v0.0.6

func (store *Store) QueueFindByID(id string) (QueueInterface, error)

QueueFindByID finds a Queue by ID

func (*Store) QueueFindNextQueuedTask added in v0.2.1

func (store *Store) QueueFindNextQueuedTask() (QueueInterface, error)

func (*Store) QueueFindRunning added in v0.2.1

func (store *Store) QueueFindRunning(limit int) []QueueInterface

func (*Store) QueueList added in v0.0.6

func (store *Store) QueueList(query QueueQueryInterface) ([]QueueInterface, error)

func (*Store) QueueProcessNext added in v0.2.2

func (store *Store) QueueProcessNext() error

func (*Store) QueueRunGoroutine added in v0.2.3

func (store *Store) QueueRunGoroutine(processSeconds int, unstuckMinutes int)

QueueRunGoroutine goroutine to run the queue

Example: go myTaskStore.QueueRunGoroutine(10, 2)

Params: - processSeconds int - time to wait until processing the next task (i.e. 10s) - unstuckMinutes int - time to wait before mark running tasks as failed

func (*Store) QueueSoftDelete added in v1.1.0

func (store *Store) QueueSoftDelete(queue QueueInterface) error

func (*Store) QueueSoftDeleteByID added in v0.5.0

func (store *Store) QueueSoftDeleteByID(id string) error

func (*Store) QueueSuccess added in v0.0.6

func (st *Store) QueueSuccess(queue QueueInterface) error

QueueSuccess completes a queued task successfully

func (*Store) QueueUnstuck added in v0.2.1

func (store *Store) QueueUnstuck(waitMinutes int)

QueueUnstuck clears the queue of tasks running for more than the specified wait time as most probably these have abnormally exited (panicked) and stop the rest of the queue from being processed

The tasks are marked as failed. However, if they are still running in the background and they are successfully completed, they will be marked as success

================================================================= Business Logic 1. Checks is there are running tasks in progress 2. If running for more than the specified wait minutes mark as failed =================================================================

func (*Store) QueueUpdate added in v0.0.6

func (store *Store) QueueUpdate(queue QueueInterface) error

QueueUpdate creates a Queue

func (*Store) QueuedTaskForceFail added in v0.2.1

func (store *Store) QueuedTaskForceFail(queuedTask QueueInterface, waitMinutes int) error

func (*Store) QueuedTaskProcess added in v0.0.7

func (store *Store) QueuedTaskProcess(queuedTask QueueInterface) (bool, error)

func (*Store) SqlCreateQueueTable added in v0.0.6

func (st *Store) SqlCreateQueueTable() string

SqlCreateQueueTable returns a SQL string for creating the Queue table

func (*Store) SqlCreateTaskTable

func (st *Store) SqlCreateTaskTable() string

SqlCreateTaskTable returns a SQL string for creating the Task table

func (*Store) TaskCount added in v1.1.0

func (store *Store) TaskCount(options TaskQueryInterface) (int64, error)

func (*Store) TaskCreate

func (store *Store) TaskCreate(task TaskInterface) error

func (*Store) TaskDelete added in v1.1.0

func (store *Store) TaskDelete(task TaskInterface) error

func (*Store) TaskDeleteByID added in v1.1.0

func (store *Store) TaskDeleteByID(id string) error

func (*Store) TaskEnqueueByAlias added in v0.0.6

func (st *Store) TaskEnqueueByAlias(taskAlias string, parameters map[string]interface{}) (QueueInterface, error)

TaskEnqueueByAlias finds a task by its alias and appends it to the queue

func (*Store) TaskExecuteCli added in v0.3.0

func (store *Store) TaskExecuteCli(alias string, args []string) bool

TaskExecuteCli - CLI tool to find a task by its alias and execute its handler - alias "list" is reserved. it lists all the available commands

func (*Store) TaskFindByAlias added in v0.0.6

func (store *Store) TaskFindByAlias(alias string) (task TaskInterface, err error)

func (*Store) TaskFindByID

func (store *Store) TaskFindByID(id string) (task TaskInterface, err error)

func (*Store) TaskHandlerAdd added in v0.0.7

func (store *Store) TaskHandlerAdd(taskHandler TaskHandlerInterface, createIfMissing bool) error

func (*Store) TaskHandlerList added in v0.0.8

func (store *Store) TaskHandlerList() []TaskHandlerInterface

func (*Store) TaskList

func (store *Store) TaskList(query TaskQueryInterface) ([]TaskInterface, error)

func (*Store) TaskSoftDelete added in v1.1.0

func (store *Store) TaskSoftDelete(task TaskInterface) error

func (*Store) TaskSoftDeleteByID added in v1.1.0

func (store *Store) TaskSoftDeleteByID(id string) error

func (*Store) TaskUpdate

func (store *Store) TaskUpdate(task TaskInterface) error

type StoreInterface added in v1.1.0

type StoreInterface interface {
	AutoMigrate() error
	EnableDebug(debug bool) StoreInterface

	QueueCount(options QueueQueryInterface) (int64, error)
	QueueCreate(Queue QueueInterface) error
	QueueDelete(Queue QueueInterface) error
	QueueDeleteByID(id string) error
	QueueFindByID(QueueID string) (QueueInterface, error)
	QueueList(query QueueQueryInterface) ([]QueueInterface, error)
	QueueSoftDelete(Queue QueueInterface) error
	QueueSoftDeleteByID(id string) error
	QueueUpdate(Queue QueueInterface) error

	QueueRunGoroutine(processSeconds int, unstuckMinutes int)
	QueuedTaskProcess(queuedTask QueueInterface) (bool, error)

	TaskEnqueueByAlias(alias string, parameters map[string]interface{}) (QueueInterface, error)
	TaskExecuteCli(alias string, args []string) bool

	TaskCount(options TaskQueryInterface) (int64, error)
	TaskCreate(Task TaskInterface) error
	TaskDelete(Task TaskInterface) error
	TaskDeleteByID(id string) error
	TaskFindByAlias(alias string) (TaskInterface, error)
	TaskFindByID(id string) (TaskInterface, error)
	TaskList(options TaskQueryInterface) ([]TaskInterface, error)
	TaskSoftDelete(Task TaskInterface) error
	TaskSoftDeleteByID(id string) error
	TaskUpdate(Task TaskInterface) error

	TaskHandlerList() []TaskHandlerInterface
	TaskHandlerAdd(taskHandler TaskHandlerInterface, createIfMissing bool) error
}

type TaskHandlerBase added in v0.0.10

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

func (*TaskHandlerBase) ErrorMessage added in v0.0.10

func (handler *TaskHandlerBase) ErrorMessage() string

func (*TaskHandlerBase) GetParam added in v0.0.10

func (handler *TaskHandlerBase) GetParam(paramName string) string

func (*TaskHandlerBase) GetParamArray added in v0.0.10

func (handler *TaskHandlerBase) GetParamArray(paramName string) []string

func (*TaskHandlerBase) HasQueuedTask added in v0.0.10

func (handler *TaskHandlerBase) HasQueuedTask() bool

func (*TaskHandlerBase) InfoMessage added in v0.0.10

func (handler *TaskHandlerBase) InfoMessage() string

func (*TaskHandlerBase) LogError added in v0.0.10

func (handler *TaskHandlerBase) LogError(message string)

func (*TaskHandlerBase) LogInfo added in v0.0.10

func (handler *TaskHandlerBase) LogInfo(message string)

func (*TaskHandlerBase) LogSuccess added in v0.0.10

func (handler *TaskHandlerBase) LogSuccess(message string)

func (*TaskHandlerBase) Options added in v0.2.0

func (handler *TaskHandlerBase) Options() map[string]string

func (*TaskHandlerBase) QueuedTask added in v0.0.10

func (handler *TaskHandlerBase) QueuedTask() QueueInterface

func (*TaskHandlerBase) SetOptions added in v0.2.0

func (handler *TaskHandlerBase) SetOptions(options map[string]string)

func (*TaskHandlerBase) SetQueuedTask added in v0.2.0

func (handler *TaskHandlerBase) SetQueuedTask(queuedTask QueueInterface)

func (*TaskHandlerBase) SuccessMessage added in v0.0.10

func (handler *TaskHandlerBase) SuccessMessage() string

type TaskHandlerInterface added in v0.0.7

type TaskHandlerInterface interface {
	Alias() string

	Title() string

	Description() string

	Handle() bool

	SetQueuedTask(queuedTask QueueInterface)

	SetOptions(options map[string]string)
}

type TaskInterface added in v1.1.0

type TaskInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	IsActive() bool
	IsCanceled() bool
	IsSoftDeleted() bool

	Alias() string
	SetAlias(alias string) TaskInterface

	CreatedAt() string
	CreatedAtCarbon() *carbon.Carbon
	SetCreatedAt(createdAt string) TaskInterface

	Description() string
	SetDescription(description string) TaskInterface

	ID() string
	SetID(id string) TaskInterface

	Memo() string
	SetMemo(memo string) TaskInterface

	SoftDeletedAt() string
	SoftDeletedAtCarbon() *carbon.Carbon
	SetSoftDeletedAt(deletedAt string) TaskInterface

	Status() string
	SetStatus(status string) TaskInterface

	Title() string
	SetTitle(title string) TaskInterface

	UpdatedAt() string
	UpdatedAtCarbon() *carbon.Carbon
	SetUpdatedAt(updatedAt string) TaskInterface
}

func NewTask added in v1.1.0

func NewTask() TaskInterface

func NewTaskFromExistingData added in v1.1.0

func NewTaskFromExistingData(data map[string]string) TaskInterface

type TaskQueryInterface added in v1.1.0

type TaskQueryInterface interface {
	Validate() error

	Columns() []string
	SetColumns(columns []string) TaskQueryInterface

	HasCountOnly() bool
	IsCountOnly() bool
	SetCountOnly(countOnly bool) TaskQueryInterface

	HasAlias() bool
	Alias() string
	SetAlias(alias string) TaskQueryInterface

	HasCreatedAtGte() bool
	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) TaskQueryInterface

	HasCreatedAtLte() bool
	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) TaskQueryInterface

	HasID() bool
	ID() string
	SetID(id string) TaskQueryInterface

	HasIDIn() bool
	IDIn() []string
	SetIDIn(idIn []string) TaskQueryInterface

	HasLimit() bool
	Limit() int
	SetLimit(limit int) TaskQueryInterface

	HasOffset() bool
	Offset() int
	SetOffset(offset int) TaskQueryInterface

	HasSortOrder() bool
	SortOrder() string
	SetSortOrder(sortOrder string) TaskQueryInterface

	HasOrderBy() bool
	OrderBy() string
	SetOrderBy(orderBy string) TaskQueryInterface

	HasSoftDeletedIncluded() bool
	SoftDeletedIncluded() bool
	SetSoftDeletedIncluded(withDeleted bool) TaskQueryInterface

	HasStatus() bool
	Status() string
	SetStatus(status string) TaskQueryInterface

	HasStatusIn() bool
	StatusIn() []string
	SetStatusIn(statusIn []string) TaskQueryInterface
}

func TaskQuery added in v1.1.0

func TaskQuery() TaskQueryInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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