resolver

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterResolver

func RegisterResolver(name string, r Resolver)

RegisterResolver register resolver factory to registry. This function is called from init() functions in files that define a resolver.

Types

type BaseResolver

type BaseResolver struct{}

BaseResolver contains common logic for checking request prerequisites.

func (*BaseResolver) BuildAPI

func (b *BaseResolver) BuildAPI(req *http.Request, mappingParams []config.MappingParam) (*router.API, error)

func (*BaseResolver) PreCheck

func (b *BaseResolver) PreCheck(req *http.Request) error

type Resolver

type Resolver interface {
	// Resolve attempts to create an API configuration from the given HTTP context.
	// If the resolver can handle the request, it returns a configured *router.API and a nil error.
	// If the resolver is not applicable to this request, it should return (nil, error).
	// If an actual error occurs during processing, it should return (nil, error).
	Resolve(ctx *contexthttp.HttpContext) (*router.API, error)
}

Resolver defines the interface for resolving an HTTP request to a specific API configuration. It allows for multiple resolution strategies to be implemented and tried in sequence.

func GetResolver

func GetResolver(name string) (Resolver, error)

GetResolver dynamically creates a resolver.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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