Documentation ¶
Overview ¶
Package util contains utility functions used by various commands.
Index ¶
- Constants
- func BinaryFileSystem(root string) *binaryFileSystem
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func Download(url, target string) error
- func LoadTemplates(path string, list ...string) (multitemplate.Render, error)
- func Unzip(archive, target string) error
- type InstallManifestsRepo
- type PrefixWriter
Constants ¶
const ( LEVEL_0 = iota LEVEL_1 LEVEL_2 LEVEL_3 )
Variables ¶
This section is empty.
Functions ¶
func BinaryFileSystem ¶
func BinaryFileSystem(root string) *binaryFileSystem
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.
func Download ¶
Download downloads resource given by url and writes it to target. target should not exist already, as it is created by the function.
func LoadTemplates ¶
func LoadTemplates(path string, list ...string) (multitemplate.Render, error)
Types ¶
type InstallManifestsRepo ¶
type InstallManifestsRepo struct { // Namespace of the repo (e.g. hasura from github.com/hasura). Namespace string // Name of the repo (e.g. graphql-engine-install-manifests from // github.com/hasura/graphql-engine-install-manifests). Name string }
InstallManifestsRepo is the GitHub repo where GraphQL Engine installation manifests are kept.
func (*InstallManifestsRepo) Download ¶
func (i *InstallManifestsRepo) Download() (dir string, err error)
Download downloads the repo contents into a temporary directory and returns the directory path. It is the caller's responsibility to remove the directory after handling the contents.
func (*InstallManifestsRepo) ZipExtractedDirectory ¶
func (i *InstallManifestsRepo) ZipExtractedDirectory() string
ZipExtractedDirectory returns the name of directory obtained after extracting the ZIP file downloaded from GitHub.
func (*InstallManifestsRepo) ZipURL ¶
func (i *InstallManifestsRepo) ZipURL() string
ZipURL returns the URL to download the repo from GitHub in ZIP format.
type PrefixWriter ¶
type PrefixWriter interface { // Write writes text with the specified indentation level. Write(level int, format string, a ...interface{}) // WriteLine writes an entire line with no indentation level. WriteLine(a ...interface{}) // Flush forces indendation to be reset. Flush() }
PrefixWriter can write text at various indentation levels.
func NewPrefixWriter ¶
func NewPrefixWriter(out io.Writer) PrefixWriter
NewPrefixWriter creates a new PrefixWriter.