Documentation ¶
Overview ¶
Package sessionstore is a postgresql backend implementation of gorilla/sessions Session interface, based on antonlindstrom/pgstore. Key change is to use GORM instead of typical sql driver using queries.
Index ¶
- func NewFilesystemStore(conf config.ServerConf) *sessions.FilesystemStore
- type PGStore
- func (store *PGStore) Get(r *http.Request, name string) (*sessions.Session, error)
- func (store *PGStore) MaxAge(age int)
- func (store *PGStore) MaxLength(l int)
- func (store *PGStore) New(r *http.Request, name string) (*sessions.Session, error)
- func (store *PGStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFilesystemStore ¶
func NewFilesystemStore(conf config.ServerConf) *sessions.FilesystemStore
NewFilesystemStore takes session key pairs to create a session-store in the local fs without using a db.
Types ¶
type PGStore ¶
type PGStore struct { Codecs []securecookie.Codec Options *sessions.Options Path string Repo *repository.Repository }
PGStore is a wrapper around gorilla/sessions store.
func NewStore ¶
func NewStore(repo *repository.Repository, conf config.ServerConf) (*PGStore, error)
NewStore takes an initialized db and session key pairs to create a session-store in postgres db.
func (*PGStore) Get ¶
Get Fetches a session for a given name after it has been added to the registry.
func (*PGStore) MaxAge ¶
MaxAge sets the maximum age for the store and the underlying cookie implementation. Individual sessions can be deleted by setting Options.MaxAge = -1 for that session.
func (*PGStore) MaxLength ¶
MaxLength restricts the maximum length of new sessions to l. If l is 0 there is no limit to the size of a session, use with caution. The default for a new PGStore is 4096. PostgreSQL allows for max value sizes of up to 1GB (http://www.postgresql.org/docs/current/interactive/datatype-character.html)