utils

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 21 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 CheckDirExists added in v0.2.105

func CheckDirExists(dir, dirName string) error

func Convert2Title added in v0.2.46

func Convert2Title(text string) string

func ConvertPrice2AttoFil added in v0.2.54

func ConvertPrice2AttoFil(price string) string

func CopyFile

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

func CreateDir added in v0.0.9

func CreateDir(dir string) error

func CreateDirIfNotExists added in v0.2.105

func CreateDirIfNotExists(dir, dirName string) error

func CreateFileWithByteContents added in v0.2.57

func CreateFileWithByteContents(filefullpath string, contents []byte) (int, error)

func CreateFileWithContents

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

func DecodeJwtToken added in v0.0.9

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

func DirSize added in v0.3.0

func DirSize(dir string) (size int64, err error)

func FirstLetter2Upper added in v0.2.51

func FirstLetter2Upper(text string) string

func GenerateFile added in v0.0.9

func GenerateFile(filepath, filename string, filesize int64)

func GetByteSizeFromStr

func GetByteSizeFromStr(sizeStr string) int64

func GetCurrentEpoch

func GetCurrentEpoch() int

func GetCurrentUtcMilliSecond added in v0.2.125

func GetCurrentUtcMilliSecond() (millis int64)

func GetCurrentUtcSecond added in v0.2.125

func GetCurrentUtcSecond() int64

func GetDayNumFromEpoch

func GetDayNumFromEpoch(epoch int) int

func GetDecimalFromStr

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

func GetDefaultTaskName added in v0.2.102

func GetDefaultTaskName() string

func GetEpochFromDay

func GetEpochFromDay(day int) int

func GetFieldFromJson

func GetFieldFromJson(jsonBytes []byte, fieldName string) interface{}

func GetFieldMapFromJson

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

func GetFieldStrFromJson

func GetFieldStrFromJson(jsonBytes []byte, fieldName string) string

func GetFileSize

func GetFileSize(fileFullPath string) int64

func GetFileSize2

func GetFileSize2(dir, fileName string) int64

func GetFilesSize added in v0.2.117

func GetFilesSize(dir string) (*int64, error)

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 GetPriceFormat added in v0.2.55

func GetPriceFormat(price string) string

func GetRandInRange

func GetRandInRange(min, max int) int

func GetStr added in v0.2.73

func GetStr(val interface{}) string

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 ReadCSVFile added in v0.3.0

func ReadCSVFile(filepath string) ([][]string, error)

func ReadFile

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

func ReadRawCSVFile added in v0.3.0

func ReadRawCSVFile(filepath string) ([][]string, error)

func RemoveFile

func RemoveFile(filePath, fileName string)

func SearchFloat64FromStr added in v0.2.51

func SearchFloat64FromStr(source string) *float64

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