session

package
v0.1.0-alpha.18 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Domain

type Domain struct {
	Repository *Repository
	Service    *Service
}

func New

func New(db db) *Domain

func (*Domain) GetRepository

func (d *Domain) GetRepository() any

type Repository

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

func NewRepository

func NewRepository(db db) *Repository

func (*Repository) Create

func (r *Repository) Create(ctx context.Context, session *Session) error

func (*Repository) Delete

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

func (*Repository) DeleteByUserId

func (r *Repository) DeleteByUserId(ctx context.Context, userId string) error

func (*Repository) Get

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

func (*Repository) GetByUserId

func (r *Repository) GetByUserId(ctx context.Context, userID string) (*Session, error)

func (*Repository) Migrations

func (r *Repository) Migrations() fs.FS

type Service

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

func NewService

func NewService(repo *Repository) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, session *Session) error

func (*Service) CreateSessionForUser

func (s *Service) CreateSessionForUser(ctx context.Context, userId string) (string, error)

func (*Service) DeleteSession

func (s *Service) DeleteSession(ctx context.Context, id string) error

func (*Service) DeleteSessionsByUserId

func (s *Service) DeleteSessionsByUserId(ctx context.Context, userId string) error

func (*Service) Get

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

func (*Service) GetByUserId

func (s *Service) GetByUserId(ctx context.Context, id string) (*Session, error)

func (*Service) GetUserIdFromSessionId

func (s *Service) GetUserIdFromSessionId(ctx context.Context, id string) (string, error)

type Session

type Session struct {
	ID      string    `db:"id"      json:"id"`
	User    string    `db:"user"    json:"user"`
	Created time.Time `db:"created" json:"created"`
	Expires time.Time `db:"expires" json:"expires"`
}

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