url

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Rendered for js/wasm

Overview

Package url wraps javascript url object and funcions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(obj interface{}) string

Create returns a URL representing the obj.

func Revoke

func Revoke(link string)

Revoke releases an existing object URL. https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL

Types

type Params

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

Params represents javascript URLSearchParams. https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams

func (*Params) Append

func (p *Params) Append(name, value string) *Params

Append appends a value to the key.

func (*Params) Delete

func (p *Params) Delete(name string) *Params

Delete removes the key from parameters.

func (*Params) Foreach

func (p *Params) Foreach(fn func(key, value string))

Foreach applies fn on each key/value pair.

func (*Params) Get

func (p *Params) Get(name string) (string, bool)

Get returns the first value of the key.

func (*Params) GetAll

func (p *Params) GetAll(name string) []string

GetAll returns all values of the key.

func (*Params) Has

func (p *Params) Has(name string) bool

Has returns boolean indicates whether or not params has the key.

func (*Params) JSValue

func (p *Params) JSValue() js.Value

JSValue ...

func (*Params) Set

func (p *Params) Set(name, value string) *Params

Set sets value for the key.

func (*Params) String

func (p *Params) String() string

type URL

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

URL represents jaavascript url. https://developer.mozilla.org/en-US/docs/Web/API/URL

func New

func New(link string) *URL

New returns a URL object.

func (*URL) Hash

func (u *URL) Hash() string

Hash returns hash property.

func (*URL) Host

func (u *URL) Host() string

Host returns host property.

func (*URL) Hostname

func (u *URL) Hostname() string

Hostname returns hostname property.

func (*URL) Href

func (u *URL) Href() string

Href returns href property.

func (*URL) JSValue

func (u *URL) JSValue() js.Value

JSValue ...

func (*URL) Origin

func (u *URL) Origin() string

Origin returns origin property.

func (*URL) Params

func (u *URL) Params() *Params

Params returns parameters in url.

func (*URL) Password

func (u *URL) Password() string

Password returns password property.

func (*URL) Pathname

func (u *URL) Pathname() string

Pathname returns pathname property.

func (*URL) Port

func (u *URL) Port() string

Port returns port property.

func (*URL) Protocol

func (u *URL) Protocol() string

Protocol returns protocol property and remove ":" at end.

func (*URL) Querystring

func (u *URL) Querystring() string

Querystring returns query string in the url.

func (*URL) Search

func (u *URL) Search() string

Search returns search property.

func (*URL) SetHash

func (u *URL) SetHash(hash string) *URL

SetHash set hash property.

func (*URL) SetHost

func (u *URL) SetHost(host string) *URL

SetHost sets host property.

func (*URL) SetHostname

func (u *URL) SetHostname(hostname string) *URL

SetHostname sets hostname property.

func (*URL) SetHref

func (u *URL) SetHref(href string) *URL

SetHref sets href property.

func (*URL) SetPassword

func (u *URL) SetPassword(password string) *URL

SetPassword sets password property.

func (*URL) SetPathname

func (u *URL) SetPathname(pathname string) *URL

SetPathname sets pathname property.

func (*URL) SetPort

func (u *URL) SetPort(port int) *URL

SetPort sets port property.

func (*URL) SetProtocol

func (u *URL) SetProtocol(protocol string) *URL

SetProtocol sets protocol property. Append ":" automatically if protocol is not end with ":".

func (*URL) SetQuerystring

func (u *URL) SetQuerystring(query string) *URL

SetQuerystring sets query string in the url.

func (*URL) SetSearch

func (u *URL) SetSearch(search string) *URL

SetSearch sets search property.

func (*URL) SetUsername

func (u *URL) SetUsername(username string) *URL

SetUsername sets username property.

func (*URL) String

func (u *URL) String() string

func (*URL) Username

func (u *URL) Username() string

Username returns username property.

Jump to

Keyboard shortcuts

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