Skip to content

Can the *bun.DB connection be used concurrently in goroutines? #915

Answered by kylemcc
ivoras asked this question in Q&A
Discussion options

You must be logged in to vote

@ivoras I'm not one of the maintainers, but I have spent a fair amount of time in the codebase and am using bun in a number of applications in production. I can confirm that a *bun.DB instance can be used concurrently. A *bun.DB is mostly a light wrapper around a sql.DB, which maintains a connection pool and is also safe for concurrent use.

You can't use queries (e.g., the result of a db.NewSelect() or db.NewInsert()) concurrently, though.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ivoras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants