Documentation ¶
Index ¶
Examples ¶
Constants ¶
View Source
const DefaultBucketname = "_boltstore_sessions"
DefaultBucketname is unsurprisingly the default name of the bucket in which the sessions are stored.
Variables ¶
View Source
var ( // ErrInsufficientKeys is returned by New if no key were given for encryption // and/or signing of the cookies. ErrInsufficientKeys = errors.New("No keys or keypairs were given") // ErrSessionNotStored is returned by Get if there was a valid session, // but no data was found in the database. ErrSessionNotStored = errors.New("session not found in store") )
Functions ¶
Types ¶
type IDGeneratorFunc ¶
An IDGeneratorFunc is used to generate a unique session ID.
Example ¶
package main import ( "fmt" "net/http" boltstore "github.com/mwmahlberg/gorilla-boltstore" ) func main() { gen := boltstore.IDGeneratorFunc(func(_ *http.Request) (string, error) { return "foo", nil }) id, _ := gen(nil) fmt.Println(id) }
Output: foo
func DefaultIDGenerator ¶
func DefaultIDGenerator() IDGeneratorFunc
DefaultIDGenerator is the default implementation of IDGeneratorFunc. It generates a UUID V4 string.
type SessionStoreOption ¶
type SessionStoreOption func(s *store) error
A SessionStoreOption sets parameters for the session store.
func IDGenerator ¶
func IDGenerator(f IDGeneratorFunc) SessionStoreOption
IDGenerator sets the function that is used to generate unique IDs for each session.
By default, a UUID V4 is used to generate unique IDs.
func Keys ¶
func Keys(keyPairs ...[]byte) SessionStoreOption
Keys sets the key pairs for encryting and signing the secure cookies set.
func SessionBucket ¶
func SessionBucket(name string) SessionStoreOption
SessionBucket sets the name of the boltdb bucket in which the sessions are stored.
func SessionOptions ¶
func SessionOptions(options *sessions.Options) SessionStoreOption
SessionOptions sets the options for the sessions.
Click to show internal directories.
Click to hide internal directories.