session

package
v0.0.0-...-646d846 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: Unlicense Imports: 7 Imported by: 0

Documentation

Overview

Package session manages sessions in Redis.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	Redis              *redis.Pool
	MaxSessionDuration time.Duration
}

Service is the session service, which manages sessions in Redis.

func (*Service) Get

func (s *Service) Get(ctx context.Context, token string) (*Session, error)

Get fetches an existing session by token, if it exists or hasn't expired.

func (*Service) New

func (s *Service) New(ctx context.Context, sess *Session) (string, error)

New creates and persists a new session.

type Session

type Session struct {
	AccountID int64
}

Session stores session data.

Jump to

Keyboard shortcuts

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