uri

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2020 License: BSD-3-Clause Imports: 7 Imported by: 81

README

uri

CircleCI pkg.go.dev Go module codecov.io GA

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

This section is empty.

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(s string) URI

New parses and creates a new URI from s.

func Parse

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

Parse parses and creates a new URI from s.

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.

Jump to

Keyboard shortcuts

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