sessioninfo

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: MIT Imports: 5 Imported by: 2

Documentation

Overview

Package sessioninfo handles session information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IDFromCtx added in v0.7.0

func IDFromCtx(ctx context.Context) ccc.UUID

IDFromCtx returns the sessionID from the request context

func IDFromRequest added in v0.7.0

func IDFromRequest(r *http.Request) ccc.UUID

IDFromRequest returns the sessionID from the request

Types

type CTXKey added in v0.7.0

type CTXKey string

CTXKey is a type for storing values in the request context

const (
	// CtxSessionInfo is the key used to store the SessionInfo in the context.
	CtxSessionInfo CTXKey = "sessionInfo"
	// CtxUserInfo is the key used to store the UserInfo in the context.
	CtxUserInfo CTXKey = "userInfo"

	// CTXSessionID is the key for storing SessionID in context
	CTXSessionID CTXKey = "sessionID"
)

type SessionInfo

type SessionInfo struct {
	ID        ccc.UUID
	Username  string
	CreatedAt time.Time
	UpdatedAt time.Time
	Expired   bool
}

SessionInfo struct contains information about a session

func FromCtx added in v0.1.2

func FromCtx(ctx context.Context) *SessionInfo

FromCtx returns the session information from the context.

func FromRequest

func FromRequest(r *http.Request) *SessionInfo

FromRequest returns the session information from the request context.

type UserInfo added in v0.6.1

type UserInfo struct {
	ID       ccc.UUID `spanner:"Id"           db:"Id"`
	Username string   `spanner:"Username"     db:"Username"`
	Disabled bool     `spanner:"Disabled"     db:"Disabled"`
}

UserInfo struct contains information about a user

func UserFromCtx added in v0.6.1

func UserFromCtx(ctx context.Context) *UserInfo

UserFromCtx returns the user information from the context

func UserFromRequest added in v0.6.1

func UserFromRequest(r *http.Request) *UserInfo

UserFromRequest returns the user information from the request context

Jump to

Keyboard shortcuts

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