I am working on building an abstraction over a library to enqueue jobs and came up with this initial module https://play.golang.org/p/X7kc2coDAG but I feel like this isn't really idiomatic. What can be done better here?
EDIT: pasting the code here
package main
import (
"github.com/gocraft/work"
"log"
)
// Params is used to pass the parameters for a given job to the worker.
type Params map[string]interface{}
// Dispatcher wraps all methods for handling the dispatch of a job.
//
// Dispatch sends a job to be processed.
type Dispatcher interface {
Dispatch(name string, params Params) error
}
// Job holds the enqueuer used to dispatch jobs to the worker.
type Job struct {
enqueuer *work.Enqueuer
}
func (j *Job) Dispatch(name string, params Params) error {
log.Println("Enquing job: ", name)
_, err := j.enqueuer.Enqueue(name, params)
if err != nil {
return err
}
return nil
}
