utils

package
v0.0.0-...-36f0857 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APIToGo

func APIToGo(s string) string

APIToGo returns the Go version of API call, eg. cluster.health => ClusterHealth

func Chromatize

func Chromatize(r io.Reader) (io.Reader, error)

Chromatize returns a syntax highlighted Go code.

func EsVersion

func EsVersion(fpath string) (string, error)

EsVersion returns the Elasticsearch from environment variable, Java property file, or an error.

func GitCommit

func GitCommit(fpath string) (string, error)

GitCommit returns the Git commit from environment variable or parsing information from fpath, or an error.

func GitTag

func GitTag(fpath string) (string, error)

GitTag returns the Git tag for fpath if available, or an error.

func IDToUpper

func IDToUpper(s string) string

IDToUpper returns a string with all occurrences of "id" capitalized.

func IsTTY

func IsTTY() bool

IsTTY returns true when os.Stderr is a terminal.

func MapKeys

func MapKeys(s interface{}) (keys []string)

MapKeys returns the map keys as a slice of strings.

func MapValues

func MapValues(s interface{}) (values []interface{})

MapValues returns the map values as a slice of interfaces.

func NameToGo

func NameToGo(s string, api ...string) string

NameToGo returns a Go version of name, eg. node_id => NodeID.

func PrintErr

func PrintErr(err error)

PrintErr prints an error to STDERR.

func PrintSourceWithErr

func PrintSourceWithErr(out io.Reader, err error)

PrintSourceWithErr returns source code annotated with location of an error.

func TerminalWidth

func TerminalWidth() int

TerminalWidth returns the width of terminal, or zero.

func TypeToGo

func TypeToGo(s string, comment ...bool) string

TypeToGo returns a Go version of type, eg. boolean => *bool.

Types

This section is empty.

Jump to

Keyboard shortcuts

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