session

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TTL         = time.Hour
	ErrNotFound = fmt.Errorf("session not found")
)

Functions

func Configure

func Configure()

func Delete

func Delete(ctx context.Context, id string) error

func MarkSeen

func MarkSeen(ctx context.Context, id string) error

Types

type Scanner

type Scanner interface {
	Scan(dest ...any) error
}

type Session

type Session struct {
	ID         string
	User       string
	IpAddress  string
	CreatedAt  time.Time
	LastSeenAt time.Time
	ExpiresAt  time.Time
}

func Create

func Create(ctx context.Context, user, ipAddress string) (*Session, error)

func Get

func Get(ctx context.Context, id string) (*Session, error)

func List

func List(ctx context.Context, user string) ([]*Session, error)

func (*Session) IsExpired

func (s *Session) IsExpired() bool

Jump to

Keyboard shortcuts

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