This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func newEventCreatedTask(ctx context.Context, s domain.Event) (*asynq.Task, error) { | |
payload := map[string]interface{}{"event_id": s.ID, "payload": string(s.Payload)} // some type for payload | |
task, err := domain.NewTask(ctx, payload) | |
if err != nil { | |
log.Error("unable to create new task: %s", err.Error()) | |
return nil, err | |
} | |
// transform to raw data | |
data, err := json.Marshal(*task) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Hey All! Most devs (including me) uses Proxy and Decorators on a daily basis but doesn't know to implement or use one. I wanted to show two snippets me and @Nicolas Mendzylewski wrote that might be useful in the future: | |
const withOBAPIAuth = function withOBAPIAuthenticationToken(proto) { | |
const handler = { | |
get(target, propKey) { |