toolbox

package module
v0.0.0-...-8f682ba Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 21 Imported by: 10

README

go-tools

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllSameNumbers

func AllSameNumbers(n []int) bool

func AllSameStrings

func AllSameStrings(a []string) bool

func BaseURL

func BaseURL(url string) string

func CombineFiles

func CombineFiles(files []string, filename string) error

func Command

func Command(timeout int, command string, args ...string) string

func CopyFile

func CopyFile(sourcePath, destinationPath string) error

func CopyMap

func CopyMap[K, V comparable](m map[K]V) map[K]V

func CountLines

func CountLines(r io.Reader) (int, error)

func DecodeJSON

func DecodeJSON(in []byte) (any, error)

func DeleteFile

func DeleteFile(filepath string) error

func Difference

func Difference(a, b []string) []string

func DownloadFile

func DownloadFile(filepath string, url string, headers map[string]string) (written int64, err error)

DownloadFile returns the number of bytes written.

func EpochTime

func EpochTime() int64

func EpochTimeStr

func EpochTimeStr() string

func EpochToZulu

func EpochToZulu(epoch int64) string

func Equals

func Equals(exp, act interface{}) bool

func FileExists

func FileExists(filename string) bool

func FindMatch

func FindMatch(filePath, pattern string) ([]string, error)

func HasString

func HasString(ss []string, str string) bool

func HasStrings

func HasStrings(str string, ss ...string) (bool, int)

func HashFile

func HashFile(filePath string) (string, error)

func IndexOf

func IndexOf(element string, data []string) int

func JoinURL

func JoinURL(base string, paths ...string) string

func LastString

func LastString(ss []string) string

func MakeTempFile

func MakeTempFile(tempFileDir, prefix string) (f string, err error)

func MinMax

func MinMax(array []int) (int, int)

func ParseURL

func ParseURL(someURL string) string

func RandomString

func RandomString(length int) string

func ReadFileToBytes

func ReadFileToBytes(filePath string) ([]byte, error)

func ReadFileToString

func ReadFileToString(filePath string) (string, error)

func SSH

func SSH(ipAddress, command string) (string, error)

func SendRequest

func SendRequest(method RequestMethod, url, body string, headers map[string]string) (int, []byte, error)

func TempDir

func TempDir() string

func TimeStamp

func TimeStamp() string

func TrimString

func TrimString(s string) (string, error)

func UniqueFloats

func UniqueFloats(floatSlice []float64) []float64

func UniqueInts

func UniqueInts(intSlice []int) []int

func WalkMatch

func WalkMatch(root, pattern string) ([]string, error)

Types

type RequestMethod

type RequestMethod byte
const (
	HEAD RequestMethod = iota
	GET
	POST
	PUT
	DELETE
)

func (RequestMethod) String

func (method RequestMethod) String() string

Jump to

Keyboard shortcuts

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