utils

package
v0.1.0-beta.202310060640 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2023 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Timing []timeLog

Functions

func AreFilesEqual

func AreFilesEqual(file1, file2 string) (bool, error)

func DisplayProfileData

func DisplayProfileData()

func FileModTime

func FileModTime(filePath string) (time.Time, error)

func FilenameNoExtension

func FilenameNoExtension(fileName string) string

func GetPluginName

func GetPluginName(plugin string) string

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 IsMacM1

func IsMacM1() (bool, error)

IsMacM1 returns whether the system is a Mac M1 machine

func LogTime

func LogTime(operation string)

func MergeMaps

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

func MoveFile(source string, destination string) error

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 PluginFQNToSchemaName

func PluginFQNToSchemaName(pluginFQN string) string

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 Pluralize

func Pluralize(base string, count int) string

Pluralize :: pluralizes a word (if applicable) based on provided count

func SafeIntEqual

func SafeIntEqual(i1, i2 *int) bool

func SafeStringsEqual

func SafeStringsEqual(s1, s2 interface{}) bool

func SliceToLookup

func SliceToLookup[K comparable](src []K) map[K]struct{}

func SortedMapKeys

func SortedMapKeys[V any](m map[string]V) []string

func TimeNow

func TimeNow() *time.Time

TimeNowPtr returns a pointer to the current time in UTC.

func TimePtr

func TimePtr(t time.Time) *time.Time

TimePtr returns a pointer to the time.Time value passed in.

func ToIntegerPointer

func ToIntegerPointer(i int) *int

ToIntegerPointer converts an integer into its pointer

func ToStringPointer

func ToStringPointer(s string) *string

ToStringPointer converts a string into its pointer

func TrimGitUrls

func TrimGitUrls(urls []string) []string

Modifies(trims) the URL if contains http ot https in arguments

func TrimSchemaName

func TrimSchemaName(pluginFQN string) string

func UnderlyingArch

func UnderlyingArch() (string, error)

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 UserConfirmation

func UserConfirmation(warning string) bool

UserConfirmation displays the warning message and asks the user for input regarding whether to continue or not

Types

This section is empty.

Jump to

Keyboard shortcuts

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