std

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: BSD-3-Clause Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Invoker = func(payloadType reflect.Type, payloadValue, funcValue reflect.Value, funcType reflect.Type) {

	if payloadType.Kind() == reflect.Ptr {
		funcValue.Call([]reflect.Value{payloadValue})
	} else {
		funcValue.Call([]reflect.Value{reflect.Indirect(payloadValue)})
	}
}

Functions

func GetHandler

func GetHandler(name string) (interface{}, bool)

func GetPayloadName

func GetPayloadName(payload interface{}) string

func InvokeHandler

func InvokeHandler(payload interface{}) (e error)

func Listen added in v0.0.4

func Listen(job interface{}, fn interface{})

func MarshalPayload

func MarshalPayload(payload interface{}) ([]byte, error)

Types

type Job

type Job struct {
	ID          string
	PayloadType string
	Payload     []byte
}

func ToJob

func ToJob(payload interface{}) (j Job, e error)

func (Job) Invoke

func (j Job) Invoke(before ...func(payloadType reflect.Type, payloadValue reflect.Value)) (e error)

type NsqHandler added in v0.0.8

type NsqHandler struct {
}

func (NsqHandler) HandleMessage added in v0.0.8

func (NsqHandler) HandleMessage(m *nsq.Message) error

type Worker

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

func NewWorker

func NewWorker(concurrency int, connection contracts.Connection) *Worker

func (*Worker) Close

func (w *Worker) Close() error

func (*Worker) Run

func (w *Worker) Run(done chan struct{}) error

Jump to

Keyboard shortcuts

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