gocraft/web

Context holding dB sessions ?

joeblew99 opened this issue · 2 comments

I use rethinkdb.
Is the context thread safe to hold dB sessions ?

Also I need to write none http servers. I would like to use as much shared code across both.
I am still learning, but what advicecan you offer here.

Thanks in advance. And sorry for such open questions

A new context is created for each request. If you have a rethinkdb connection, you could assign it to the context in a middleware.

I'm not sure what none http servers are?

Ok thanks for reply.

About "None Servers", sorry badly typed. What i was wondering about is how to reuse DB session code between HTTP based server and non HTTP daemons. I think i have worked it out in the last day though, so all good.