utils

package
v0.2.38 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateRealCost added in v0.2.22

func CalculateRealCost(sectorSizeBytes float64, pricePerGiB decimal.Decimal) decimal.Decimal

func CopyFile

func CopyFile(srcFilePath, destFilePath string) (int64, error)

func CreateDir added in v0.0.9

func CreateDir(dir string) error

func CreateFileWithContents

func CreateFileWithContents(filepath string, lines []string) (int, error)

func DecodeJwtToken added in v0.0.9

func DecodeJwtToken(tokenStr string) (jwt.MapClaims, error)

func GenerateFile added in v0.0.9

func GenerateFile(filepath, filename string, filesize int64)

func GetByteSizeFromStr

func GetByteSizeFromStr(sizeStr string) *float64

func GetCurrentEpoch

func GetCurrentEpoch() int

func GetDayNumFromEpoch

func GetDayNumFromEpoch(epoch int) int

func GetDecimalFromStr

func GetDecimalFromStr(source string) (*decimal.Decimal, error)

func GetEpochFromDay

func GetEpochFromDay(day int) int

func GetEpochInMillis

func GetEpochInMillis() (millis int64)

GetEpochInMillis get current timestamp

func GetFieldFromJson

func GetFieldFromJson(jsonStr string, fieldName string) interface{}

func GetFieldMapFromJson

func GetFieldMapFromJson(jsonStr string, fieldName string) map[string]interface{}

func GetFieldStrFromJson

func GetFieldStrFromJson(jsonStr string, fieldName string) string

func GetFileSize

func GetFileSize(fileFullPath string) int64

func GetFileSize2

func GetFileSize2(dir, fileName string) int64

func GetFloat64FromStr

func GetFloat64FromStr(numStr *string) (float64, error)

func GetInt64FromStr

func GetInt64FromStr(numStr string) int64

func GetIntFromStr

func GetIntFromStr(numStr string) (int, error)

func GetMinFloat64

func GetMinFloat64(val1, val2 *float64) *float64

func GetNumStrFromStr

func GetNumStrFromStr(numStr string) string

func GetPathType

func GetPathType(dirFullPath string) int

func GetRandInRange

func GetRandInRange(min, max int) int

func IsDirExists added in v0.0.9

func IsDirExists(dir string) bool

func IsFileExists

func IsFileExists(filePath, fileName string) bool

func IsFileExistsFullPath added in v0.2.16

func IsFileExistsFullPath(fileFullPath string) bool

func IsPathFile

func IsPathFile(dirFullPath string) (*bool, error)

func IsSameDay

func IsSameDay(nanoSec1, nanoSec2 int64) bool

func IsStrEmpty

func IsStrEmpty(str *string) bool

func RandString added in v0.2.20

func RandString(optionChars string, strLen int) string

func RandStringRunes added in v0.0.9

func RandStringRunes(letterRunes []rune, strLen int) string

func ReadAllLines

func ReadAllLines(dir, filename string) ([]string, error)

func ReadFile

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

func RemoveFile

func RemoveFile(filePath, fileName string)

func ToJson

func ToJson(obj interface{}) string

func UrlJoin

func UrlJoin(root string, parts ...string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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