rethinkdb_session_store

package module
v0.0.0-...-55f3204 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2014 License: Apache-2.0 Imports: 5 Imported by: 1

README

rethinkdb_session_store

RethinkDB session support for Gorilla Web Toolkit.

Dependencies

Gorilla Web Toolkit:

go get github.com/gorilla/securecookie
go get github.com/gorilla/sessions

Dan Cannon's rethinkdb driver:

go get github.com/dancannon/gorethink

Usage

import (
  "github.com/dancannon/gorethink"
  "github.com/miquella/rethinkdb_session_store"
)

rsession, _ := rdb.Connect(rdb.ConnectOpts{Address:  "localhost:28015"})
store := rethinkdb_session_store.NewRethinkDBStore(rsession, "web", "sessions", []byte("secret-key"))

...

func handler(w http.ResponseWriter, r *http.Request) {
  session, _ := store.Get(r, "session")
  session.Values["foo"] = "bar"
  session.Save(r, w)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RethinkDBStore

type RethinkDBStore struct {
	Codecs  []securecookie.Codec
	Options *sessions.Options // default configuration
	// contains filtered or unexported fields
}

func NewRethinkDBStore

func NewRethinkDBStore(rethinkdbSession *gorethink.Session, db, table string, keyPairs ...[]byte) *RethinkDBStore

func (*RethinkDBStore) Get

func (s *RethinkDBStore) Get(r *http.Request, name string) (*sessions.Session, error)

func (*RethinkDBStore) New

func (s *RethinkDBStore) New(r *http.Request, name string) (*sessions.Session, error)

func (*RethinkDBStore) Save

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL