utils

package
v1.0.0-exp2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseURLToFilename

func BaseURLToFilename(u *url.URL) string

BaseURLToFilename turns the base of a URL (scheme, hostname, port) into a valid filename. This method replaces the port part with a special string token (because ":" cannot be used in filenames on some platforms).

func LookupBoolEnv added in v0.9.25

func LookupBoolEnv(key string, fallback bool) bool

func LookupIntEnv added in v0.9.25

func LookupIntEnv(key string, fallback int) int

func Max

func Max(a, b int) int

func Min

func Min(a, b int) int

func UrlToFilename

func UrlToFilename(u *url.URL) string

UrlToFilename turns the provided URL into a hashed filename. URLs can contain characters that cannot be used in filenames (like "?", "#", ":"), so in order to cache them properly, they are deterministically hashed into ASCII strings.

Types

type GistCommit added in v0.9.25

type GistCommit struct {
	Version string `json:"version"`
}

func GetLastGistCommit added in v0.9.25

func GetLastGistCommit(gistID string) (*GistCommit, error)

type GitCommit added in v0.9.25

type GitCommit struct {
	Sha string `json:"sha"`
}

func GetLastGitCommit added in v0.9.25

func GetLastGitCommit(owner string, name string) (*GitCommit, error)

type GithubGist added in v0.9.23

type GithubGist struct {
	Description string `json:"description"`
	ID          string `json:"id"`
	Owner       struct {
		Login string `json:"login"`
	} `json:"owner"`
}

func FetchGithubGist added in v0.9.23

func FetchGithubGist(gistID string) (*GithubGist, error)

type GithubRepo added in v0.6.1

type GithubRepo struct {
	Name            string
	FullName        string `json:"full_name"`
	Description     string
	HtmlUrl         string `json:"html_url"`
	StargazersCount int    `json:"stargazers_count"`
	Topics          []string
}

func FetchGithubRepository added in v0.9.23

func FetchGithubRepository(owner string, name string) (*GithubRepo, error)

Jump to

Keyboard shortcuts

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