SQL session store for the Gorilla web toolkit.
Work in progress, API may not be stable. Currently only supports the PostgreSQL dialect.
See the Gorilla toolkit sessions documentation on how to use the sessions package.
Get the package go get github.com/jstemmer/sqlstore
and import
github.com/jstemmer/sqlstore
.
Call sqlstore.New()
to create a new store. You'll need a database handle from
the database/sql
package. See the
session.NewCookieStore
documentation on how to use the keyPairs parameter.
store := sqlstore.New(db, []byte("something-very-secret"))
Sessions are stored in a sessions
table, which is assumed to exist. It should
have the following schema:
CREATE TABLE sessions (
id varchar(100) PRIMARY KEY,
data bytea NOT NULL,
created_at timestamp NOT NULL,
updated_at timestamp NOT NULL
);
http://godoc.org/github.com/jstemmer/sqlstore
MIT, see LICENSE.