selector

package
v0.0.3-beta.5 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSelectorMiddleware

func NewSelectorMiddleware(matcher Matcher, middlewares ...httpx.Middleware) httpx.Middleware

NewSelectorMiddleware creates a chain of middleware that only execute when the matcher condition is met. This allows conditional application of middleware based on request characteristics.

Types

type MatchFunc

type MatchFunc func(ctx httpx.Context) bool

MatchFunc is a function type that implements the Matcher interface. This allows functions to be used directly as matchers without defining new types.

func (MatchFunc) Match

func (m MatchFunc) Match(ctx httpx.Context) bool

Match implements the Matcher interface for MatchFunc.

type Matcher

type Matcher interface {
	Match(ctx httpx.Context) bool
}

Matcher defines the interface for request matching logic. Implementations determine whether a given request context matches specific criteria.

func NewContextMatcher

func NewContextMatcher[T comparable](key string, value T) Matcher

NewContextMatcher creates a matcher that checks for a specific value in the Gin context. It performs type-safe comparison of context values.

func NewLogicalAndMatcher

func NewLogicalAndMatcher(matchers ...Matcher) Matcher

NewLogicalAndMatcher creates a matcher that returns true only if all provided matchers match. It implements logical AND operation across multiple matchers.

func NewLogicalNotMatcher

func NewLogicalNotMatcher(matcher Matcher) Matcher

NewLogicalNotMatcher creates a matcher that inverts the result of another matcher.

func NewLogicalOrMatcher

func NewLogicalOrMatcher(matchers ...Matcher) Matcher

NewLogicalOrMatcher creates a matcher that returns true if any of the provided matchers match. It implements logical OR operation across multiple matchers.

Jump to

Keyboard shortcuts

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