alexedwards / scs

HTTP Session Management for Go
MIT License
2.09k stars 166 forks source link

Implement pgxstore #95

Closed abgeana closed 3 years ago

abgeana commented 4 years ago

pgxstore is a session store for postgresql based on the github.com/jackc/pgx package. The implementation is almost identical to the existing postgresstore package, with the only difference being the postgresql driver.

bojanz commented 3 years ago

Is there a reason why this store uses a single connection, instead of accepting the entire pgxpool?

alexedwards commented 3 years ago

@abgeana I'm really sorry, somehow I completely missed this PR.

I will review in the next few days and merge.

Thank you!

bojanz commented 3 years ago

@alexedwards @abgeana Why was my comment about using a single connection ignored? No pgx app I've used has done pgx.Connect(), they all use pgxpool like pgx recommends, so at least the example in the README isn't realistic. Holding a single connection is typically only needed when some kind of SQL-level locking is done (e.g. for migrations).

abgeana commented 3 years ago

I needed to use scs in a project of mine where the implemented use case was enough. I do not know of other use cases, or how (un-)realistic the example in the README is. That is the reason why the store uses a single connection.

alexedwards commented 3 years ago

@bojanz Your comment has not been ignored. I'm working on adapting the pgxstore to use a pool right now.

bojanz commented 3 years ago

Awesome, thank you. Just wanted to make sure we're moving in the right direction.

alexedwards commented 3 years ago

@bojanz This is now done and everything seems to be working correctly with a connection pool. I committed the change a while ago, but wanted to wait until the old version was cleared from the Go module proxy before confirming.