storage icon indicating copy to clipboard operation
storage copied to clipboard

[Feature Request] Ability to pass in or retrieve database connections to/from storage structures

Open Technerder opened this issue 3 years ago • 3 comments

Like the title suggests, I believe the should be a able to either pass in a database connection to session storage structures or be able to be able to retrieve them for other non session specific database operations as opposed to having 2 separate/different sql drivers and connections (1 for sessions and 1 for other db stuff)

Technerder avatar Jun 26 '21 18:06 Technerder

@Technerder so you propose that you could pass a db (connection) interface instead of the config to the storage middleware and then later on also be able to retrieve it?

Sounds like a good idea, might start working on a PR pretty soon.

anton7r avatar Sep 02 '21 14:09 anton7r

Yeah, working on something like this here https://github.com/gofiber/storage/pull/153

Technerder avatar Sep 02 '21 17:09 Technerder

https://github.com/gofiber/storage/pull/153/files#diff-a537808f48341a30aa18ae06a27a21209fa58e4f2a0247dfb933edecce97a12eR13

i see, perhaps i should follow the same sort of design philosophy with the other storage interfaces with a v2 subfolder on the other ones.

anton7r avatar Sep 02 '21 18:09 anton7r

@Technerder I think this is fixed by #451

gaby avatar Dec 11 '22 06:12 gaby

This is now supported by calling:

store.Conn() // returns pointer to DB connection used by the store

gaby avatar Jan 19 '23 04:01 gaby