utils

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MediaTypeTextPlain         = MediaType("text/plain; charset=utf-8")
	MediaTypeOctetStream       = MediaType("application/octet-stream")
	MediaTypeHTML              = MediaType("text/html")
	MediaTypeJSON              = MediaType("application/json")
	MediaTypeMultipartFormData = MediaType("multipart/form-data")
	MediaTypeFormURLEncoded    = MediaType("application/x-www-form-urlencoded")
	MediaTypeZip               = MediaType("application/zip")
)

The set of known MediaTypes

Variables

View Source
var (
	// CLIVersion represents the current version of the CLI. This version is dynamically replaced at build-time
	CLIVersion = "1.0.0"

	// CLIOSArch represents the OS Architecture of the CLI. It is used to select the appropriate URL for the CLI
	// binary based on the user's OS
	CLIOSArch string
)

Functions

func CheckForNewCLIVersion

func CheckForNewCLIVersion(client HTTPClient) string

CheckForNewCLIVersion looks for and returns a url for a new version of the CLI, if one exists. Any errors are swallowed.

func GetDirectoryContainingFile

func GetDirectoryContainingFile(wd, filename string) (string, error)

GetDirectoryContainingFile searches upwards for a valid Stitch app directory

func RandomAlphaNumericSpecialString

func RandomAlphaNumericSpecialString(length int) string

RandomAlphaNumericSpecialString generates a new random alphanumeric key with special characters

func RandomAlphaNumericSpecialStringStrict

func RandomAlphaNumericSpecialStringStrict(length int) string

RandomAlphaNumericSpecialStringStrict generates a new random alphanumeric key with special characters

func RandomAlphaNumericString

func RandomAlphaNumericString(length int) string

RandomAlphaNumericString generates a new random alphanumeric key

func RandomAlphaString

func RandomAlphaString(length int) string

RandomAlphaString generates a new random alphabetic string of given length

func ReadAndUnmarshalInto

func ReadAndUnmarshalInto(marshalFn func(in []byte, out interface{}) error, path string, out interface{}) error

ReadAndUnmarshalInto unmarshals data from the given path into an interface{} using the provided marshalFn

func UnmarshalFromDir

func UnmarshalFromDir(path string) (map[string]interface{}, error)

UnmarshalFromDir unmarshals a Stitch app from the given directory into a map[string]interface{}

func WriteZipToDir

func WriteZipToDir(dest string, zipData io.Reader, overwrite bool) error

WriteZipToDir takes a destination and an io.Reader containing zip data and unpacks it

Types

type HTTPClient

type HTTPClient interface {
	Get(url string) (*http.Response, error)
}

HTTPClient represents the minimum HTTP client required to check for version information

type MediaType

type MediaType string

MediaType defines the type of HTTP media in a request/response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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