url

package
v0.0.0-...-5127ed8 Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinURL

func JoinURL(originalURL string, paths ...interface{}) (joinedURL string, err error)

JoinURL updates the path part of the request url.

JoinURL("google.com", "admin") => "google.com/admin"
JoinURL("google.com?q=keyword", "admin") => "google.com/admin?q=keyword"

func MustJoinURL

func MustJoinURL(originalURL string, paths ...interface{}) (joinedURL string)

func PatchURL

func PatchURL(originalURL string, params ...interface{}) (patchedURL string, err error)

PatchURL updates the query part of the request url.

PatchURL("google.com","key","value") => "google.com?key=value"
PatchURL("google.com?key=value","key","value") => "google.com"
PatchURL("google.com", "~a[]","b") => "google.com?a[]=b"
PatchURL("google.com?a[]=b","~a[]","c") => "google.com?a[]=b&a[]=c"
PatchURL("google.com?a[]=b&a[]=c","~a[]","c") => "google.com?a[]=b"

Types

type Flag

type Flag bool

type FlagParam

type FlagParam struct {
	Name  string
	Value bool
}

type Param

type Param struct {
	Name   string
	Values []string
}

Jump to

Keyboard shortcuts

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