Documentation ¶
Index ¶
- Variables
- func BuildRequestPayload(signature string, payload map[string]interface{}) *bytes.Buffer
- func DisplayProfileData()
- func EnsureDirectoryPermission(directoryPath string) error
- func FileModTime(filePath string) (time.Time, error)
- func FilenameNoExtension(fileName string) string
- func Filter[V any](elements []V, predicate func(V) bool) []V
- func FindProcess(targetPid int) (*psutils.Process, error)
- func GetPluginName(plugin string) string
- func IsMacM1() (bool, error)
- func IsPortBindable(port int) error
- func IsWSL() bool
- func JsonCloneToMap(val any) (map[string]any, error)
- func LocalAddresses() ([]string, error)
- func LogTime(operation string)
- func Map[V any, M any](elements []V, mapper func(V) M) []M
- func MergeMaps[M ~map[K]V, K comparable, V any](old, new M) M
- func MoveFile(source string, destination string) error
- func OpenBrowser(url string) error
- func ParseCertificateInLocation(location string) (*x509.Certificate, error)
- func Partition[V any](elements []V, predicate func(V) bool) ([]V, []V)
- func PidExists(targetPid int) (bool, error)
- func PluginFQNToSchemaName(pluginFQN string) string
- func Pluralize(base string, count int) string
- func PrettifyJsonFromReader(dataToExport io.Reader) (io.Reader, error)
- func RemoveDirectoryContents(removePath string) error
- func SafeIntEqual(i1, i2 *int) bool
- func SafeStringsEqual(s1, s2 interface{}) bool
- func SendRequest(ctx context.Context, signature string, method string, sendRequestTo url.URL, ...) (*http.Response, error)
- func SortedMapKeys[V any](m map[string]V) []string
- func ToIntegerPointer(i int) *int
- func ToStringPointer(s string) *string
- func TrimSchemaName(pluginFQN string) string
- func UnderlyingArch() (string, error)
- func UnquoteStringArray(stringArray []string) []string
- func Unzip(src, dst string) ([]string, error)
- func WriteCertificate(path string, certificate []byte) error
- func WritePrivateKey(path string, key *rsa.PrivateKey) error
- type ExitCode
- type InteractiveExitStatus
- type Semaphore
Constants ¶
This section is empty.
Variables ¶
var Timing []timeLog
Functions ¶
func BuildRequestPayload ¶
BuildRequestPayload merges the provided payload with the standard payload that needs to be sent
func DisplayProfileData ¶
func DisplayProfileData()
func FilenameNoExtension ¶ added in v0.17.0
func Filter ¶
Filter returns a new slice only containing the elements for which invoking the predicate returned true
The predicate is invoked with each element
func FindProcess ¶
FindProcess tries to find the process with the given pid returns nil if the process could not be found
func GetPluginName ¶ added in v0.17.0
GetPluginName function is used to get the plugin name required while installing/updating/removing a plugin. External plugins require the repo names to be prefixed(eg: francois2metz/scalingo). Sample input 1: hub.steampipe.io/plugins/francois2metz/scalingo@latest Sample output 1: francois2metz/scalingo Sample input 2: hub.steampipe.io/plugins/turbot/aws@latest Sample output 2: aws
func IsPortBindable ¶
func IsWSL ¶
func IsWSL() bool
IsWSL detects whether app is running in WSL environment refer to: https://github.com/Microsoft/WSL/issues/423#issuecomment-679190758
func JsonCloneToMap ¶ added in v0.19.0
JsonCloneToMap tries to JSON marshal and unmarshal the given data, returning a map[string]any if successful
func LocalAddresses ¶
func Map ¶
Map returns a new slice where every value is mapped to a new value through the mapper
The mapper is invoked with each element
func MergeMaps ¶ added in v0.17.0
func MergeMaps[M ~map[K]V, K comparable, V any](old, new M) M
MergeMaps merges 'new' onto 'old'. Values existing in old already have precedence Any value existing in new but not old is added to old
func MoveFile ¶
MoveFile moves a file from source to destiantion.
It first attempts the movement using OS primitives (os.Rename) If os.Rename fails, it copies the file byte-by-byte to the destination and then removes the source
func OpenBrowser ¶ added in v0.17.0
https://stackoverflow.com/questions/39320371/how-start-web-server-to-open-page-in-browser-in-golang
func ParseCertificateInLocation ¶ added in v0.17.0
func ParseCertificateInLocation(location string) (*x509.Certificate, error)
func Partition ¶
Partition splits the array of elements into two groups: the left partition contains elements that the predicate returns `true` for. the right partition contains elements that the predicate returns `false` for.
The predicate is invoked with each element
func PidExists ¶
PidExists scans through the list of PIDs in the system and checks for the `targetPID`.
PidExists uses iteration, instead of signalling, since we have observed that signalling does not always work reliably when the destination of the signal is a child of the source of the signal - which may be the case then starting implicit services
func PluginFQNToSchemaName ¶ added in v0.19.0
PluginFQNToSchemaName convert a full plugin name to a schema name schemas in postgres are limited to 63 chars - the name may be longer than this, in which case trim the length and add a hash to the end to make unique
func PrettifyJsonFromReader ¶ added in v0.17.0
func RemoveDirectoryContents ¶
func SafeIntEqual ¶
func SafeStringsEqual ¶
func SafeStringsEqual(s1, s2 interface{}) bool
func SendRequest ¶
func SendRequest(ctx context.Context, signature string, method string, sendRequestTo url.URL, payload io.Reader) (*http.Response, error)
SendRequest makes a http call to the given URL
func SortedMapKeys ¶ added in v0.17.0
func ToIntegerPointer ¶
ToIntegerPointer converts an integer into its pointer
func ToStringPointer ¶
ToStringPointer converts a string into its pointer
func TrimSchemaName ¶ added in v0.19.0
func UnderlyingArch ¶
UnderlyingArch detects the underlying architecture(amd64/arm64) of the system we need this to detect the underlying architecture to install the correct FDW package
func UnquoteStringArray ¶ added in v0.17.0
UnquoteStringArray removes quote marks from elements of string array
func Unzip ¶
Unzip - from https://stackoverflow.com/questions/20357223/easy-way-to-unzip-file-with-golang
func WriteCertificate ¶ added in v0.17.0
func WritePrivateKey ¶ added in v0.17.0
func WritePrivateKey(path string, key *rsa.PrivateKey) error
Types ¶
type InteractiveExitStatus ¶
type InteractiveExitStatus struct { // TODO remove altogether ExitCode int }
InteractiveExitStatus :: exist status from the interative prompt
We exit go-prompt after every query (in order to manage the prompt history to only include complete queries) We therefore need to distinguish between:
a user requested exit (ctrl+D or .exit) - indicated by a non-nil exit code and restart=false and a value , go-prompt being terminated after a query completion and requiring restarting - indicated by restart=true