/sqlstore

SQL session store for gorilla/sessions

Primary LanguageGoMIT LicenseMIT

sqlstore

SQL session store for the Gorilla web toolkit.

Work in progress, API may not be stable. Currently only supports the PostgreSQL dialect.

Build Status

Usage

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
);

Documentation

http://godoc.org/github.com/jstemmer/sqlstore

License

MIT, see LICENSE.