uri

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: BSD-3-Clause Imports: 7 Imported by: 1

README

uri

test pkg.go.dev Go module

Package uri is an implementation of the URI Uniform Resource Identifier(RFC3986) specification for Go.

Documentation

Overview

Package uri is an implementation of the URI Uniform Resource Identifier(RFC3986) specification for Go.

Index

Constants

View Source
const (
	// FileScheme schema of filesystem path.
	FileScheme = "file"

	// HTTPScheme schema of http.
	HTTPScheme = "http"

	// HTTPSScheme schema of https.
	HTTPSScheme = "https"
)

Variables

This section is empty.

Functions

func IsFileURI

func IsFileURI(uri string) bool

Types

type URI

type URI string

URI Uniform Resource Identifier (URI) https://tools.ietf.org/html/rfc3986.

This class is a simple parser which creates the basic component parts (http://tools.ietf.org/html/rfc3986#section-3) with minimal validation and encoding.

  foo://example.com:8042/over/there?name=ferret#nose
  \_/   \______________/\_________/ \_________/ \__/
   |           |            |            |        |
scheme     authority       path        query   fragment
   |   _____________________|__
  / \ /                        \
  urn:example:animal:ferret:nose

func File

func File(path string) URI

File parses and creates a new filesystem URI from path.

func From

func From(scheme, authority, path, query, fragment string) URI

From returns the new URI from args.

func New

func New(input string) URI

New parses and creates a new URI from input.

func Parse

func Parse(input string) (u URI, err error)

Parse parses and creates a new URI from input.

func (URI) Filename

func (u URI) Filename() string

Filename returns the file path for the given URI. It is an error to call this on a URI that is not a valid filename.

func (URI) HasFilename

func (u URI) HasFilename() bool

Returns true if URI has a valid filename

Jump to

Keyboard shortcuts

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