resolver

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultResolver = NewRegistry()
View Source
var (
	ErrSchemeNotRegistered = errors.New("scheme not registered")
)

Functions

func Register

func Register(scheme string, resolver Resolver)

func Resolve

func Resolve(ctx context.Context, path string) (io.ReadCloser, error)

func SetDefault added in v0.22.0

func SetDefault(scheme string)

func WithResolver added in v0.10.0

func WithResolver(ctx context.Context, resolver Resolver) context.Context

func WithWorkDir added in v0.10.0

func WithWorkDir(ctx context.Context, path Path) context.Context

Types

type Path added in v0.29.0

type Path string

func ContextWorkDir added in v0.10.0

func ContextWorkDir(ctx context.Context) Path

func (Path) Abs added in v0.29.4

func (p Path) Abs() (Path, error)

func (Path) Base added in v0.29.1

func (p Path) Base() Path

func (Path) Dir added in v0.29.0

func (p Path) Dir() Path

Dir returns the directory part of the path

func (Path) Host added in v0.29.0

func (p Path) Host() string

Host returns the host part of the URL, or empty string if not a URL

func (Path) IsAbs added in v0.29.0

func (p Path) IsAbs() bool

func (Path) IsURL added in v0.29.0

func (p Path) IsURL() bool

IsURL returns true if the path is a valid URL

func (Path) Join added in v0.29.0

func (p Path) Join(paths ...Path) Path

func (Path) JoinPath added in v0.29.0

func (p Path) JoinPath(paths ...string) Path

JoinPath joins the current path with additional path segments

func (Path) Scheme added in v0.29.0

func (p Path) Scheme() string

Scheme returns the scheme of the path if it's a URL, empty string otherwise

func (Path) String added in v0.29.0

func (p Path) String() string

func (Path) URL added in v0.29.0

func (p Path) URL() (*url.URL, error)

func (Path) URLPath added in v0.29.0

func (p Path) URLPath() string

URLPath returns the path part of the URL, or the full string if not a URL

func (Path) WithAuth added in v0.29.0

func (p Path) WithAuth(username, password string) Path

WithAuth returns a new Path with basic authentication credentials

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() *Registry

func (*Registry) Extend

func (r *Registry) Extend(extensions ...func() (scheme string, resolver Resolver)) *Registry

func (*Registry) Register

func (r *Registry) Register(scheme string, resolver Resolver)

func (*Registry) Resolve

func (r *Registry) Resolve(ctx context.Context, path Path) (io.ReadCloser, error)

Resolve implements Resolver.

func (*Registry) SetDefault added in v0.22.0

func (r *Registry) SetDefault(scheme string)

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, path Path) (io.ReadCloser, error)
}

func ContextResolver added in v0.10.0

func ContextResolver(ctx context.Context) Resolver

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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