Hi Sam,
What do you think about adding Context support? My suggestions are:
1- Setting it connection-wide like db.WithContext(context.Context) and each runner interface check if ctx is nil or not and call suitable sql func.
2- For each runner interface add context param with naming suffix ...Ctx like db.SelectFrom("books").DoCtx(&books, ctx). This one will need every runner and Transaction methods to be duplicated for Context parameter with Ctx suffix but more Go-like.
3- Without changing any interface, altering current runners with contex'ed ones internally, and get/set context with a function. For ex: db.SelectFrom("books").Do() internally will run ExecTx with ctx.Background.
If you can check and give directions I can add a PR for this according to your suggestions or better you can add this to godb.
Erkan.
Hi Sam,
What do you think about adding
Contextsupport? My suggestions are:1- Setting it connection-wide like
db.WithContext(context.Context)and each runner interface check if ctx isnilor not and call suitablesqlfunc.2- For each runner interface add context param with naming suffix
...Ctxlikedb.SelectFrom("books").DoCtx(&books, ctx). This one will need every runner and Transaction methods to be duplicated forContextparameter withCtxsuffix but moreGo-like.3- Without changing any interface, altering current runners with contex'ed ones internally, and get/set context with a function. For ex:
db.SelectFrom("books").Do()internally will runExecTxwithctx.Background.If you can check and give directions I can add a PR for this according to your suggestions or better you can add this to
godb.Erkan.