Client
Overview
Client enqueues background tasks.
Part of the queue package — Node.js analog: bull.
Client is a type exported by gox. Methods on this type are documented separately.
Signature
go
type Client struct {
// contains filtered or unexported fields
}Compare: Node.js · Standard Go · gox
js
// Typical bull pattern in Node.jsgo
// hibiken/asynq client + workergo
import "github.com/sahilkhaire/gox/queue"
mr, err := miniredis.Run()
defer mr.Close()
c := queue.New(mr.Addr())
defer c.Close()
mux := queue.NewServeMux()
mux.HandleFunc("email:send", func(ctx context.Context, payload []byte) error {
return nil
})Example
go
import "github.com/sahilkhaire/gox/queue"
mr, err := miniredis.Run()
defer mr.Close()
c := queue.New(mr.Addr())
defer c.Close()
mux := queue.NewServeMux()
mux.HandleFunc("email:send", func(ctx context.Context, payload []byte) error {
return nil
})Tips
Browse methods on this type in the sidebar for handler-style APIs and options structs.
Standard library alternative
gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.