gocloud.dev: gocloud.dev/internal/openurl Index | Files

package openurl

import "gocloud.dev/internal/openurl"

Package openurl provides helpers for URLMux and URLOpeners in portable APIs.

Index

Package Files

openurl.go

type SchemeMap Uses

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

SchemeMap maps URL schemes to values. The zero value is an empty map, ready for use.

func (*SchemeMap) FromString Uses

func (m *SchemeMap) FromString(typ, urlstr string) (interface{}, *url.URL, error)

FromString parses urlstr as an URL and looks up the value for the URL's scheme.

func (*SchemeMap) FromURL Uses

func (m *SchemeMap) FromURL(typ string, u *url.URL) (interface{}, error)

FromURL looks up the value for u's scheme.

func (*SchemeMap) Register Uses

func (m *SchemeMap) Register(api, typ, scheme string, value interface{})

Register registers scheme for value; subsequent calls to FromString or FromURL with scheme will return value. api is the portable API name (e.g., "blob"); the same value should always be passed. It should be in all lowercase. typ is the portable type (e.g., "Bucket"). Register panics if scheme has already been registered.

func (*SchemeMap) Schemes Uses

func (m *SchemeMap) Schemes() []string

Schemes returns a sorted slice of the registered schemes.

func (*SchemeMap) ValidScheme Uses

func (m *SchemeMap) ValidScheme(scheme string) bool

ValidScheme returns true iff scheme has been registered.

Package openurl imports 4 packages (graph) and is imported by 7 packages. Updated 2019-07-26. Refresh now. Tools for package owners.