urlbuilder

package
v0.0.0-...-872f6c5 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidURL = errors.New("URL format is incorrect")

Functions

This section is empty.

Types

type URL

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

URL focuses on query params and treats the rest as immutable string. You can use any URL string to construct this object. Its primary goal is to "Expose Query Manipulation". Under the hood it uses url.URL library.

func New

func New(base string, path ...string) (*URL, error)

New URL will be constructed given valid full url which may have query params.

func (*URL) AddEncodingExceptions

func (u *URL) AddEncodingExceptions(exceptions map[string]string)

func (*URL) AddPath

func (u *URL) AddPath(paths ...string) *URL

func (*URL) GetFirstQueryParam

func (u *URL) GetFirstQueryParam(name string) (string, bool)

func (*URL) HasQueryParam

func (u *URL) HasQueryParam(name string) bool

func (*URL) RemoveQueryParam

func (u *URL) RemoveQueryParam(name string)

func (*URL) String

func (u *URL) String() string

func (*URL) ToURL

func (u *URL) ToURL() (*url.URL, error)

ToURL relies on String method.

func (*URL) WithQueryParam

func (u *URL) WithQueryParam(name, value string)

func (*URL) WithQueryParamList

func (u *URL) WithQueryParamList(name string, values []string)

Jump to

Keyboard shortcuts

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