session

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SameSiteLax lax same site mode
	SameSiteLax string = "Lax"
	// SameSiteStrict strict same site mode
	SameSiteStrict = "Strict"
	// SameSiteNone none same site mode
	SameSiteNone = "None"
)

SameSiteType cookie session same site constants

Variables

This section is empty.

Functions

func UUIDGenerator

func UUIDGenerator() string

UUIDGenerator Generate id using uuid

Types

type Session

type Session interface {
	// Parse session from request
	Parse()
	// ID get session id
	ID() string
	// Context get request context
	Context() *fiber.Ctx
	// Regenerate session id
	Regenerate()
	// Set session value
	Set(key string, value interface{})
	// Exists check if session is exists
	Exists(key string) bool
	// Get session value
	Get(key string) interface{}
	// Bool parse item as boolean
	Bool(key string, fallback bool) (bool, bool)
	// Int parse item as int
	Int(key string, fallback int) (int, bool)
	// Int8 parse item as int8
	Int8(key string, fallback int8) (int8, bool)
	// Int16 parse item as int16
	Int16(key string, fallback int16) (int16, bool)
	// Int32 parse item as int32
	Int32(key string, fallback int32) (int32, bool)
	// Int64 parse item as int64
	Int64(key string, fallback int64) (int64, bool)
	// UInt parse item as uint
	UInt(key string, fallback uint) (uint, bool)
	// UInt8 parse item as uint8
	UInt8(key string, fallback uint8) (uint8, bool)
	// UInt16 parse item as uint16
	UInt16(key string, fallback uint16) (uint16, bool)
	// UInt32 parse item as uint32
	UInt32(key string, fallback uint32) (uint32, bool)
	// UInt64 parse item as uint64
	UInt64(key string, fallback uint64) (uint64, bool)
	// Float32 parse item as float64
	Float32(key string, fallback float32) (float32, bool)
	// Float64 parse item as float64
	Float64(key string, fallback float64) (float64, bool)
	// String parse item as string
	String(key string, fallback string) (string, bool)
	// Bytes parse item as bytes array
	Bytes(key string, fallback []byte) ([]byte, bool)
	// All get all session stored value
	All() map[string]interface{}
	// Delete session value
	Delete(key string)
	// Destroy session
	Destroy()
	// Save session
	Save()
}

Session interface

func NewCookieSession

func NewCookieSession(cache cache.Cache, ctx *fiber.Ctx, secure bool, domain string, sameSite string, exp time.Duration, generator func() string, key string) Session

NewCookieSession create new cookie based session

func NewHeaderSession

func NewHeaderSession(cache cache.Cache, ctx *fiber.Ctx, exp time.Duration, generator func() string, key string) Session

NewHeaderSession create new header based session

Jump to

Keyboard shortcuts

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