Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidHTTPMethod = errors.New("invalid HTTP method") ErrVarsNotFoundInContext = errors.New("vars not found in context") ErrMissingMiddleware = errors.New("missing middleware") ErrMissingPathKey = errors.New("missing path key") ErrMissingRessourceKey = errors.New("missing ressource key") ErrPathKeyAndRessourceKeyAreTheSame = errors.New("path key and ressource key are the same") ErrMissingRoute = errors.New("missing route") ErrLimiterNotEnabledWithWeight = errors.New("only unlimited weight can be used if limiter is not enabled") ErrDuplicateEntry = errors.New("duplicate route entry") )
Functions ¶
Types ¶
type Client ¶
type Client interface {
contract.RouterOperator
}
func NewClient ¶
func NewClient(d Dependencies, opts ClientOptions) (Client, error)
type ClientOption ¶
type ClientOption func(*ClientOptions)
func WithPathKey ¶
func WithPathKey(key string) ClientOption
func WithRessourceKey ¶
func WithRessourceKey(key string) ClientOption
type ClientOptions ¶
func ApplyClientOptions ¶
func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions
type Dependencies ¶
type Dependencies struct {
L contract.LimiterOperator
SM contract.SemaphoreOperator
M contract.MiddlewareOperator
S contract.HTTPServer
R contract.HTTPServerRunner
}
type Pattern ¶
type Pattern = string
Pattern represents a regex pattern string.
const ( // PatID matches numeric path parameters (e.g., user ID). PatID Pattern = `[0-9]+` // PatName matches alphabetic characters only (uppercase or lowercase). PatName Pattern = `[a-zA-Z]+` // PatWord matches any word-like token (alphanumeric and underscore). PatWord Pattern = `\w+` // PatWordCI matches word-like tokens, case-insensitive. PatWordCI Pattern = `(?i)\w+` // PatEmail matches a basic email address format. PatEmail Pattern = `[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}` // PatOID matches a 24-character hexadecimal string (MongoDB ObjectID). PatOID Pattern = `[0-9a-fA-F]{24}` // PatFile matches any file name with an extension. PatFile Pattern = `.*\.[^/]*$` // PatUUID matches a UUID string in standard 8-4-4-4-12 format. PatUUID Pattern = `[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}` )
Click to show internal directories.
Click to hide internal directories.