utils

package
v0.0.0-...-8c3de14 Latest Latest
Warning

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

Go to latest
Published: May 3, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(arr []string, str string) bool

func CountIndent

func CountIndent(s string) int

func CountRune

func CountRune(s string, r rune) int

func DecodeBase64

func DecodeBase64(value string) ([]byte, error)

func DecryptWithKey

func DecryptWithKey(cipherData []byte, secretKey string) ([]byte, error)

func DecryptWithMasterKey

func DecryptWithMasterKey(data []byte) ([]byte, error)

func EncodeBase64

func EncodeBase64(value []byte) string

func EncryptWithKey

func EncryptWithKey(data []byte, secretKey string) ([]byte, error)

func EncryptWithMasterKey

func EncryptWithMasterKey(data []byte) ([]byte, error)

func FromJSON

func FromJSON(src string, dst interface{})

func GenerateRandomString

func GenerateRandomString(n int) (string, error)

GenerateRandomString returns a crypto-strong random string of specified length.

func GetCipherKey

func GetCipherKey(secretKey string) []byte

func GetDetachedCmd

func GetDetachedCmd(name string, arg ...string) *exec.Cmd

func InTrustedRoot

func InTrustedRoot(path string, trustedRoot string) error

func ReplaceEscapeSymbols

func ReplaceEscapeSymbols(s string) string

func SHA1

func SHA1(value string) string

SHA1 returns SHA1 hash of the input string.

func SliceInsert

func SliceInsert(arr []interface{}, elem interface{}, index int) []interface{}

https://stackoverflow.com/questions/46128016/insert-a-value-in-a-slice-at-a-given-index

func SliceRemove

func SliceRemove(arr []interface{}, elem interface{}) []interface{}

func SplitAndTrim

func SplitAndTrim(str string, delim string) []string

func ToJSON

func ToJSON(v interface{}) string

func ToJSONIndent

func ToJSONIndent(v interface{}) string

func TrimQuotes

func TrimQuotes(s string) string

func WhiteSpaceOnly

func WhiteSpaceOnly(s string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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