session

package
v0.0.0-...-ac0e98d Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package session provides a core business API.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("session not found")
)

Set of error variables for CRUD operations.

Functions

This section is empty.

Types

type Core

type Core struct {
	// contains filtered or unexported fields
}

Core manages the set of APIs for session access.

func NewCore

func NewCore(log *zerolog.Logger, storer Storer) *Core

NewCore constructs a session core API for use.

func (*Core) Create

func (c *Core) Create(sessn Session) (Session, error)

Create adds a new session to the system.

func (*Core) QueryByID

func (c *Core) QueryByID(id uuid.UUID) (Session, error)

QueryByID finds the session by the specified ID.

type Session

type Session struct {
	ID           uuid.UUID
	UserID       uuid.UUID
	RefreshToken string
	UserAgent    string
	ClientIP     string
	IsBlocked    bool
	ExpiresAt    time.Time
	CreatedAt    time.Time
}

Session represents information about an individual session.

type Storer

type Storer interface {
	Create(sessn Session) error
	QueryByID(id uuid.UUID) (Session, error)
}

Storer interface declares the behavior this package needs to perist and retrieve data.

Directories

Path Synopsis
Package mocksessn is a generated GoMock package.
Package mocksessn is a generated GoMock package.
Package sessiondb contains session related CRUD functionality.
Package sessiondb contains session related CRUD functionality.

Jump to

Keyboard shortcuts

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