Golang

2674 readers
1 users here now

This is a community dedicated to the go programming language.

Useful Links:

Rules:

founded 2 years ago
MODERATORS
76
77
78
79
 
 

Any particular up to date course out there? Or another useful source out there to learn it from?

80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
 

Cross-posted from "How could I allow users to schedule sending emails at a specific interval?" by @lena@gregtech.eu in !learn_programming@programming.dev


Basically, I'm trying to figure out how I could allow a user to send a schedule in the cron syntax to some API, store it into the database and then send an email to them at that interval. The code is at gragorther/epigo. I'd use go-mail to send the mails.

I found stuff like River or Asynq to schedule tasks, but that is quite complex and I have absolutely no idea what the best way to implement it would be, so help with that is appreciated <3

94
95
96
97
98
99
 
 

I'm working on a rather fresh project and that makes me question stuff I take for granted in existing projects. One of those things is how we access context. In existing projects, we use functions like "foobarFromContext(ctx)" that grab foobar from context for us. Writing to context usually happens in middleware.

When I was tinkering with deno + hono, context was frequently accessed directly instead of get funcs and it felt way more volatile? and I liked that.

I try to look at context as a "dynamic constants container", so stuff that is probably permanent for the lifespan of the context, e.g. the authorized user that made the call. So keep writing to context in middlewares is less of a problem for me, but get-funcs that have to be injected to each and every service and mocked in tests for a simple "ctx.Value("userName") sometimes seems so overengineered and makes ctx feel like some distant, transcendend thing.

What's your way?

100
view more: ‹ prev next ›