device

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidInput = errors.New("invalid input")
View Source
var ErrNotFound = errors.New("not found")

Functions

This section is empty.

Types

type Device

type Device struct {
	ID         ID
	UserID     user.ID
	PublicKey  string
	CreatedAt  time.Time
	LastSeenAt *time.Time
}

type ID

type ID string

type Repository

type Repository interface {
	Create(ctx context.Context, device Device) error
	GetByID(ctx context.Context, id ID) (Device, error)
	GetByUserAndPublicKey(ctx context.Context, userID user.ID, publicKey string) (Device, error)
	ListByUser(ctx context.Context, userID user.ID) ([]Device, error)
	ListAll(ctx context.Context) ([]Device, error)
	UpdateLastSeen(ctx context.Context, id ID, lastSeenAt time.Time) error
}

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, userID user.ID, publicKey string) (Device, error)

func (*Service) GetByUserAndPublicKey

func (s *Service) GetByUserAndPublicKey(ctx context.Context, userID user.ID, publicKey string) (Device, error)

GetByUserAndPublicKey returns a device matching a user and public key.

func (*Service) ListAll

func (s *Service) ListAll(ctx context.Context) ([]Device, error)

ListAll returns all devices in the system.

func (*Service) ListByUser

func (s *Service) ListByUser(ctx context.Context, userID user.ID) ([]Device, error)

ListByUser returns all devices for a given user.

Jump to

Keyboard shortcuts

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