django_session

package module
v0.0.0-...-aad4165 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

README

django_session

A Golang middleware to access Django sessions

Documentation

Index

Constants

View Source
const (
	SessionContextKey = "github.com/fdelbos/django-session.context_key"
)

Variables

View Source
var (
	ErrSessionInvalid = errors.New("invalid session")
)

Functions

func GetSession

func GetSession(r *http.Request) interface{}

Types

type BaseSession

type BaseSession struct {
	UserID      string `json:"_auth_user_id"`
	UserBackend string `json:"_auth_user_backend"`
	UserHash    string `json:"_auth_user_hash"`
}

type DjangoSession

type DjangoSession struct {
	Store            Store
	OnError          http.HandlerFunc
	OnInvalidSession http.HandlerFunc
}

func (DjangoSession) Filter

func (ds DjangoSession) Filter(cookieName string, dest interface{}) func(http.Handler) http.Handler

type PGXSession

type PGXSession struct {
	Pool *pgxpool.Pool
}

func (*PGXSession) Fetch

func (pgxs *PGXSession) Fetch(ctx context.Context, key string, dest interface{}) error

type SessionMiddleWare

type SessionMiddleWare interface {
	Filter(next http.Handler) http.Handler
}

type Store

type Store interface {
	Fetch(ctx context.Context, key string, dest interface{}) error
}

Jump to

Keyboard shortcuts

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