forked from mtusi2026/mtusi2026lab3
19 lines
424 B
Go
19 lines
424 B
Go
package sessionstore
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
)
|
|
|
|
var (
|
|
ErrNotFound = errors.New("session not found or expired")
|
|
ErrUnavailable = errors.New("session store unavailable")
|
|
)
|
|
|
|
type Store interface {
|
|
Create(ctx context.Context, token, userID string, ttl time.Duration) (time.Time, error)
|
|
GetUserID(ctx context.Context, token string) (string, error)
|
|
Delete(ctx context.Context, token string) (bool, error)
|
|
}
|