Documentation ¶
Index ¶
- Variables
- func BuildRequestPayload(signature string, payload map[string]interface{}) *bytes.Buffer
- func CombineErrors(errors ...error) error
- func CombineErrorsWithPrefix(prefix string, errors ...error) error
- func CtyToGo(v cty.Value) (val interface{}, err error)
- func CtyToJSON(val cty.Value) (string, error)
- func CtyToPostgresString(v cty.Value) (valStr string, err error)
- func CtyToString(v cty.Value) (valStr string, err error)
- func CtyTypeToHclType(types ...cty.Type) string
- func DebugDumpJSON(msg string, d interface{})
- func DebugDumpRows(rows *sql.Rows)
- func DebugDumpViper()
- func DiagsToError(prefix string, diags tfdiags.Diagnostics) error
- func DisplayProfileData()
- func EnsureDirectoryPermission(directoryPath string) error
- func FailOnError(err error)
- func FailOnErrorWithMessage(err error, message string)
- func FileHash(filePath string) (string, error)
- func FileModTime(filePath string) (time.Time, error)
- func Filter[V any](elements []V, predicate func(V) bool) []V
- func FindProcess(targetPid int) (*psutils.Process, error)
- func GetMD5Hash(text string) string
- func HandleCancelError(err error) error
- func IsCancelledError(err error) bool
- func IsContextCancelled(ctx context.Context) bool
- func IsMacM1() (bool, error)
- func IsPortBindable(port int) error
- func IsWSL() (bool, error)
- func LocalAddresses() ([]string, error)
- func LogTime(operation string)
- func Map[V any, M any](elements []V, mapper func(V) M) []M
- func MergeStringMaps(old, new map[string]string) map[string]string
- func MoveFile(source string, destination string) error
- func Partition[V any](elements []V, predicate func(V) bool) ([]V, []V)
- func PidExists(targetPid int) (bool, error)
- func Pluralize(base string, count int) string
- func PrefixError(err error, prefix string) error
- func RemoveDirectoryContents(removePath string) error
- func SafeIntEqual(i1, i2 *int) bool
- func SafeStringsEqual(s1, s2 interface{}) bool
- func SendRequest(signature string, method string, sendRequestTo url.URL, payload *bytes.Buffer, ...) (*http.Response, error)
- func ShowError(ctx context.Context, err error)
- func ShowErrorWithMessage(ctx context.Context, err error, message string)
- func ShowWarning(warning string)
- func SortedStringKeys[V any](m map[string]V) []string
- func SplitByRune(str string, r rune) []string
- func SplitByWhitespace(str string) []string
- func StringHash(s string) uint32
- func StringMapsEqual(l, r map[string]string) bool
- func StringSliceDistinct(slice []string) []string
- func ToIntegerPointer(i int) *int
- func ToStringPointer(s string) *string
- func TransformErrorToSteampipe(err error) error
- func UnderlyingArch() (string, error)
- func Unzip(src, dst string) ([]string, error)
- type ExitCode
- type FileWatcher
- type InteractiveExitStatus
- type LifecycleEvent
- type LifecycleTimer
- type WatcherOptions
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 CombineErrors ¶
func CombineErrorsWithPrefix ¶
func CtyToPostgresString ¶
CtyToPostgresString convert a cty value into a postgres representation of the value
func CtyToString ¶
CtyToString convert a cty value into a string representation of the value
func CtyTypeToHclType ¶
CtyTypeToHclType converts a cty type to a hcl type accept multiple types and use the first non null and non dynamic one
func DebugDumpJSON ¶
func DebugDumpJSON(msg string, d interface{})
functions specifically used for Debugging purposes.
func DebugDumpRows ¶
func DebugDumpViper ¶
func DebugDumpViper()
func DiagsToError ¶
func DiagsToError(prefix string, diags tfdiags.Diagnostics) error
DiagsToError converts tfdiags diags into an error
func DisplayProfileData ¶
func DisplayProfileData()
func FailOnError ¶
func FailOnError(err error)
func FailOnErrorWithMessage ¶
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 GetMD5Hash ¶
func HandleCancelError ¶
HandleCancelError modifies a context.Canceled error into a readable error that can be printed on the console
func IsCancelledError ¶
func IsContextCancelled ¶
func IsPortBindable ¶
func IsWSL ¶
IsWSL :: detects whether app is running in WSL environment refer to: https://github.com/Microsoft/WSL/issues/423#issuecomment-679190758
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 MergeStringMaps ¶
MergeStringMaps merges 'new' onto old. Any vakue existing in new but not old is added to old NOTE this mutates 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 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 PrefixError ¶
func RemoveDirectoryContents ¶
func SafeIntEqual ¶
func SafeStringsEqual ¶
func SafeStringsEqual(s1, s2 interface{}) bool
func SendRequest ¶
func SendRequest(signature string, method string, sendRequestTo url.URL, payload *bytes.Buffer, timeout time.Duration) (*http.Response, error)
SendRequest makes a http call to the given URL
func ShowErrorWithMessage ¶
ShowErrorWithMessage displays the given error nicely with the given message
func ShowWarning ¶
func ShowWarning(warning string)
func SortedStringKeys ¶
func SplitByRune ¶
SplitByRune uses the CSV decoder to parse out the tokens - even if they are quoted and/or escaped
func SplitByWhitespace ¶
SplitByWhitespace splits by the ' ' rune
func StringHash ¶
func StringMapsEqual ¶
func StringSliceDistinct ¶
TODO: investigate turbot/go-kit/helpers
func ToIntegerPointer ¶
ToIntegerPointer converts an integer into its pointer
func ToStringPointer ¶
ToStringPointer converts a string into its pointer
func TransformErrorToSteampipe ¶
TransformErrorToSteampipe removes the pq: and rpc error prefixes along with all the unnecessary information that comes from the drivers and libraries
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
Types ¶
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
func NewWatcher ¶
func NewWatcher(opts *WatcherOptions) (*FileWatcher, error)
func (*FileWatcher) Close ¶
func (w *FileWatcher) Close()
func (*FileWatcher) Start ¶
func (w *FileWatcher) Start()
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
type LifecycleEvent ¶
type LifecycleTimer ¶
type LifecycleTimer struct {
// contains filtered or unexported fields
}
LifecycleTimer records the time for lifecycle events
func NewLifecycleTimer ¶
func NewLifecycleTimer() *LifecycleTimer
func (*LifecycleTimer) Add ¶
func (r *LifecycleTimer) Add(event string)
func (LifecycleTimer) GetDuration ¶
func (r LifecycleTimer) GetDuration() time.Duration
GetDuration returns the duration between first and the last event
type WatcherOptions ¶
Source Files ¶
- arch.go
- collection.go
- context.go
- cty_conversion.go
- debugdump.go
- diags.go
- equals.go
- errors.go
- exit.go
- file.go
- file_watcher.go
- fs_permissions.go
- hash.go
- interactive_exit_status.go
- lifecycle_timer.go
- map.go
- net.go
- pid_exists.go
- plural.go
- pointers.go
- remove_dir_contents.go
- string.go
- string_slice.go
- timing.go
- useragent.go
- wsl.go
- zip.go