session

package
v0.0.0-...-2d52d2e Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const CookieName = "HUB_SID"

CookieName is the session cookie name

View Source
const Duration = time.Hour * 24 * 6

Duration is the default session experation

Variables

This section is empty.

Functions

This section is empty.

Types

type Mockable

type Mockable struct {
	Provider *mockableprovider.Provider
}

Mockable is a Redis SessionProvider

func (*Mockable) Get

func (p *Mockable) Get(token string) (string, error)

Get a session by token

func (*Mockable) Set

func (p *Mockable) Set(token string, userUUID string) error

Set a session by token

type Provider

type Provider interface {
	// Get a user UUID by token
	Get(token string) (string, error)
	// Set a session by token
	Set(token string, userUUI string) error
}

Provider is the Session Provider

type RedisProvider

type RedisProvider struct {
	Connection redis.Conn
}

RedisProvider is a Redis SessionProvider

func (*RedisProvider) AutoMigrate

func (p *RedisProvider) AutoMigrate(clearExitstingData bool) error

AutoMigrate the data connection

func (*RedisProvider) Get

func (p *RedisProvider) Get(token string) (string, error)

Get a session by token

func (*RedisProvider) Set

func (p *RedisProvider) Set(token string, userUUID string) error

Set a session by token

Jump to

Keyboard shortcuts

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