serverinvite

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")
	ErrNotFound     = errors.New("not found")
	ErrExpired      = errors.New("invite expired")
	ErrConsumed     = errors.New("invite already used")
)

Functions

This section is empty.

Types

type Invite

type Invite struct {
	Token      string
	CreatedAt  time.Time
	ExpiresAt  time.Time
	ConsumedAt *time.Time
	ConsumedBy *user.ID
}

type Repository

type Repository interface {
	Create(ctx context.Context, invite Invite) error
	Consume(ctx context.Context, token string, userID user.ID, now time.Time) (Invite, error)
}

type Service

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

func NewService

func NewService(repo Repository) *Service

func (*Service) Consume

func (s *Service) Consume(ctx context.Context, token string, userID user.ID) (Invite, error)

func (*Service) Create

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

Jump to

Keyboard shortcuts

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