Documentation
¶
Index ¶
- Variables
- type Device
- type ID
- type Repository
- type Service
- func (s *Service) Create(ctx context.Context, userID user.ID, publicKey string) (Device, error)
- func (s *Service) GetByUserAndPublicKey(ctx context.Context, userID user.ID, publicKey string) (Device, error)
- func (s *Service) ListAll(ctx context.Context) ([]Device, error)
- func (s *Service) ListByUser(ctx context.Context, userID user.ID) ([]Device, error)
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 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) 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.
Click to show internal directories.
Click to hide internal directories.