q

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudTasksOption

type CloudTasksOption interface {
	// String returns a string representation of the option.
	String() string

	// Type describes the type of the option.
	Type() CloudTasksOptionType

	// Value returns a value used to create this option.
	Value() interface{}
}

func ProcessAt

func ProcessAt(t time.Time) CloudTasksOption

ProcessAt returns an option to specify when to process the given task.

type CloudTasksOptionType

type CloudTasksOptionType int
const (
	ProcessAtOpt CloudTasksOptionType = iota
)

type CloudTasksQ

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

func NewCloudTasksQ

func NewCloudTasksQ(cfg Config, client *cloudtasks.Client) *CloudTasksQ

func (*CloudTasksQ) Enqueue

func (q *CloudTasksQ) Enqueue(ctx context.Context, task *Task, opts ...CloudTasksOption) (*TaskInfo, error)

type Config

type Config interface {
	GetProjectID() string
	GetLocationID() string
	GetBaseUrl() string
}

type ICloudTasksQ

type ICloudTasksQ interface {
	// Enqueue enqueues a task to the ClousTasks queue.
	Enqueue(ctx context.Context, task *Task, opts ...CloudTasksOption) (*TaskInfo, error)
}

type IPubSubQ

type IPubSubQ interface {
	// Enqueue enqueues a task to the Pub/Sub queue.
	Enqueue(ctx context.Context, task *Task, opts ...PubSubOption) (*TaskInfo, error)
}

type Message

type Message interface {
	GetUniqueKey() string
	UnmarshalData(v interface{}) error
}

type PubSubMessage

type PubSubMessage struct {
	Message struct {
		ID          string            `json:"messageId"`
		PublishTime time.Time         `json:"publishTime"`
		Data        []byte            `json:"data,omitempty"`
		OrderingKey string            `json:"orderingKey,omitempty"`
		Attributes  map[string]string `json:"attributes,omitempty"`
	} `json:"message"`
	Subscription string `json:"subscription"`
}

PubSubMessage is the payload of a Pub/Sub event. See the documentation for more details: https://cloud.google.com/pubsub/docs/reference/rest/v1/PubsubMessage

func (*PubSubMessage) GetUniqueKey

func (m *PubSubMessage) GetUniqueKey() string

func (*PubSubMessage) UnmarshalData

func (m *PubSubMessage) UnmarshalData(v interface{}) error

type PubSubOption

type PubSubOption interface {
	// String returns a string representation of the option.
	String() string

	// Type describes the type of the option.
	Type() PubSubOptionType

	// Value returns a value used to create this option.
	Value() interface{}
}

func Ordered

func Ordered(key string) PubSubOption

Ordered returns an option to specify the ordered key.

type PubSubOptionType

type PubSubOptionType int
const (
	OrderedOpt PubSubOptionType = iota
)

type PubSubQ

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

func NewPubSubQ

func NewPubSubQ(client *pubsub.Client) *PubSubQ

func (*PubSubQ) Enqueue

func (q *PubSubQ) Enqueue(ctx context.Context, task *Task, opts ...PubSubOption) (*TaskInfo, error)

type Task

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

Task represents a unit of work to be performed.

func NewTask

func NewTask(typename string, payload []byte, opts ...TaskOption) *Task

NewTask returns a new Task given a type name and payload data. Options can be passed to configure task processing behavior.

type TaskInfo

type TaskInfo struct {
	ID string
}

type TaskOption

type TaskOption interface {
	// String returns a string representation of the option.
	String() string

	// Type describes the type of the option.
	Type() TaskOptionType

	// Value returns a value used to create this option.
	Value() interface{}
}

func UniqueKey

func UniqueKey(key string) TaskOption

UniqueKey returns an option to specify the unique key.

type TaskOptionType

type TaskOptionType int
const (
	UniqueKeyOpt TaskOptionType = iota
)

Jump to

Keyboard shortcuts

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