gorm

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: MIT Imports: 10 Imported by: 0

README

GORM Store for gorilla sessions

GitHub

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	Options *sessions.Options
	// contains filtered or unexported fields
}

func NewStore

func NewStore(db *gorm.DB, options ...StoreOption) *Store

func (*Store) Close

func (s *Store) Close() error

func (*Store) Get

func (store *Store) Get(r *http.Request, name string) (*sessions.Session, error)

func (*Store) MaxAge

func (store *Store) MaxAge(age int)

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 (*Store) New

func (store *Store) New(r *http.Request, name string) (*sessions.Session, error)

func (*Store) Save

func (store *Store) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error

type StoreOption added in v0.1.1

type StoreOption func(s *Store)

func WithGCDisabled

func WithGCDisabled() StoreOption

func WithGCInterval

func WithGCInterval(gcInterval time.Duration) StoreOption

func WithInitTableDisabled

func WithInitTableDisabled() StoreOption

func WithKeyPairs

func WithKeyPairs(keyPairs ...[]byte) StoreOption

func WithSecureDisabled

func WithSecureDisabled() StoreOption

WithSecureDisabled encode session values as JSON, ONLY for development

func WithTableName

func WithTableName(tableName string) StoreOption

Jump to

Keyboard shortcuts

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