utils

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildURL added in v0.6.0

func BuildURL(baseURL string, paths []string, qParams map[string]string) (string, error)

BuildURL will construct a URL based on the paths and query params provided to the function. Each string in the paths slice will be appended the base URL using the url.JoinPath method. Additionally, all query params provided by the qParams input will be set, encoded and returned as part of the resulting string

func OpenBrowser added in v0.6.0

func OpenBrowser(url string) error

OpenBrowser takes a url (string) as input and will attempt to open the URL on your systems default browser.

func SubmitPostRequest added in v0.6.0

func SubmitPostRequest(url string, body io.Reader, h http.Header) ([]byte, error)

SubmitPostRequest is a convienience function that reduces DRY code for making an HTTP post request

Types

type FilePathDirWalker

type FilePathDirWalker struct{}

func (FilePathDirWalker) WalkDir

func (dw FilePathDirWalker) WalkDir(root string, fn fs.WalkDirFunc) error

type OSFileOpener

type OSFileOpener struct{}

func (OSFileOpener) Open

func (o OSFileOpener) Open(fileName string) (*os.File, error)

Jump to

Keyboard shortcuts

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