session

package
v0.0.0-...-4d78421 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetStore

func SetStore(newStore *Store)

Types

type Options

type Options struct {
	SkipCreateTable bool
}

Options for entstore.

type Store

type Store struct {
	Codecs      []securecookie.Codec
	SessionOpts *sessions.Options
	// contains filtered or unexported fields
}

Store represents an entstore.

func GetStore

func GetStore() (*Store, error)

func New

func New(client *ent.Client, keyPairs ...[]byte) *Store

New creates a new entstore session.

func NewOptions

func NewOptions(client *ent.Client, opts Options, keyPairs ...[]byte) *Store

NewOptions creates a new entstore session with options.

func (*Store) Cleanup

func (st *Store) Cleanup()

Cleanup deletes expired sessions.

func (*Store) Get

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

Get returns a session for the given name after adding it to the registry.

func (*Store) MaxAge

func (st *Store) MaxAge(age int)

MaxAge sets the maximum age for the store and the underlying cookie implementation.

func (*Store) MaxLength

func (st *Store) MaxLength(l int)

MaxLength restricts the maximum length of new sessions to l.

func (*Store) New

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

New creates a session with the name without adding it to the registry.

func (*Store) Save

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

Save session and set cookie header.

Jump to

Keyboard shortcuts

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