Documentation ¶ Index ¶ Variables type Invite type Repository type Service func NewService(repo Repository) *Service func (s *Service) Consume(ctx context.Context, token string, userID user.ID) (Invite, error) func (s *Service) Create(ctx context.Context) (Invite, error) 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) Source Files ¶ View all Source files invite.goservice.go Click to show internal directories. Click to hide internal directories.