testhooks

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package testhooks lets black-box tests reach unexported root behavior without widening the public API. The root package registers the hooks in an init function; the receiver is typed any because this package cannot import the root.

Index

Constants

This section is empty.

Variables

View Source
var (
	ValidateEmail        func(raw string) (string, error)
	IssueSession         func(a any, ctx context.Context, user models.User, ua, ip string) (string, models.Session, error)
	ValidateSession      func(a any, ctx context.Context, token string) (*models.Session, *models.User, error)
	RequestMagicLink     func(a any, ctx context.Context, email string) (string, error)
	ConsumeMagicLink     func(a any, ctx context.Context, token string) (string, *models.User, error)
	SetBaseURL           func(a any, url string)
	SignupWithPassword   func(a any, ctx context.Context, email, password string) (*models.User, string, error)
	SigninWithPassword   func(a any, ctx context.Context, email, password, ua, ip string) (string, *models.User, error)
	RequestPasswordReset func(a any, ctx context.Context, email string) (string, error)
	ResetPassword        func(a any, ctx context.Context, token, newPassword string) error
	NewKeyedLimiter      func(perMinute int, evictAfter, tick time.Duration) Limiter
	LinkOAuth            func(a any, ctx context.Context, sessionToken, provider, providerUserID string) error
	LinkPassword         func(a any, ctx context.Context, sessionToken, password string) error
	MergeAccounts        func(a any, ctx context.Context, sessionToken string, secondaryID models.ULID) error
	UnlinkOAuth          func(a any, ctx context.Context, sessionToken, provider string) error
	SetAPITokenClock     func(a any, now func() time.Time)
)

Hooks registered by the root package.

Functions

This section is empty.

Types

type Limiter

type Limiter interface {
	Allow(key string) bool
	Stop()
	EntryCount() int
}

Limiter is the handle over the root keyed rate limiter.

Jump to

Keyboard shortcuts

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