session

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateDTO

type CreateDTO struct {
	Token     string
	UserID    uint
	IP        string
	UserAgent string
}

func (*CreateDTO) ToEntity

func (d *CreateDTO) ToEntity() *Session

type CreatedEvent

type CreatedEvent struct {
	Data   CreateDTO
	Result Session
}

func NewCreatedEvent

func NewCreatedEvent(data CreateDTO, result Session) (*CreatedEvent, error)

type DeletedEvent

type DeletedEvent struct {
	Result Session
}

func NewDeletedEvent

func NewDeletedEvent(result Session) (*DeletedEvent, error)

type Repository

type Repository interface {
	Count(ctx context.Context) (int64, error)
	GetAll(ctx context.Context) ([]*Session, error)
	GetPaginated(ctx context.Context, limit, offset int, sortBy []string) ([]*Session, error)
	GetByToken(ctx context.Context, id string) (*Session, error)
	Create(ctx context.Context, user *Session) error
	Update(ctx context.Context, user *Session) error
	Delete(ctx context.Context, id int64) error
}

type Session

type Session struct {
	Token     string `gorm:"primaryKey"`
	UserID    uint
	IP        string
	UserAgent string
	ExpiresAt time.Time
	CreatedAt time.Time
}

func (*Session) IsExpired

func (s *Session) IsExpired() bool

func (*Session) ToGraph

func (s *Session) ToGraph() *model.Session

Jump to

Keyboard shortcuts

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