session

package
v0.0.0-...-93edf92 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2018 License: BSD-3-Clause Imports: 9 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentGuest

func CurrentGuest(c *gin.Context) *gin.H

CurrentGuest shortcut to get the current session's guest

func CurrentParty

func CurrentParty(c *gin.Context) (*models.Party, error)

CurrentParty shortcut to get the current session's party

func CurrentUser

func CurrentUser(c *gin.Context) *models.User

CurrentUser shortcut to get the current session's user

func IsGuest

func IsGuest(c *gin.Context) bool

IsGuest checks if a user is authenticated as a guest to the session

func IsLoggedIn

func IsLoggedIn(c *gin.Context) bool

IsLoggedIn checks if a user is logged in to the session

func Middleware

func Middleware(store cache.Store) gin.HandlerFunc

Middleware creates the Party session middleware

Types

type Session

type Session struct {
	ID string
	// contains filtered or unexported fields
}

Session is a hella simple string value session store for party-server

func DefaultSession

func DefaultSession(c *gin.Context) *Session

DefaultSession shortcut to get the session

func (*Session) Delete

func (s *Session) Delete(key string) error

Delete removes the session value associated with the given key

func (*Session) Error

func (s *Session) Error() (string, error)

Error retrieves an error from session flash storage

func (*Session) Flash

func (s *Session) Flash(key string, value string)

Flash a keyed value to session flash storage

func (*Session) Flashes

func (s *Session) Flashes(key ...string) ([]string, error)

Flashes retrieves values from session flash storage

func (*Session) Get

func (s *Session) Get(key string) (string, error)

Get returns the session value associated to the given key.

func (*Session) Logout

func (s *Session) Logout() error

Logout effectively ends a session by deleting user-land keys

func (*Session) Set

func (s *Session) Set(key string, value string) error

Set sets the session value associated to the given key.

Jump to

Keyboard shortcuts

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