helpers

package module
v0.0.0-...-6f9a91c Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2020 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const SYMBOL = "R$"

Variables

This section is empty.

Functions

func AddDuration

func AddDuration(t time.Time, add time.Duration) time.Time

AddDuration: Alias to time.Add()

func AppendToFile

func AppendToFile(file string, text []string) int

func Benchmark

func Benchmark(s time.Time) (string, time.Duration)

Benchmark: Basically an alis to time.Since, printing the result; also return the result as a string and time.Duration

func Bts

func Bts(b []byte) string
  • []BYTE to STRING

Bts: []BYTE to STRING

func BtsSingle

func BtsSingle(b byte) string

Bts: BYTE to STRING

func Check

func Check(e error, msg string)

Check: Looks for error and prints a custom message; ignores if error == nil

func CheckError

func CheckError(e bool, msg string)

CheckError: If error is true will save the message

func Day

func Day() string

Day: Current day as string

func Dts

func Dts(d time.Duration) string
  • DATE&TIME to STRING

Dts: Return the time.Duration as STRING

func Echo

func Echo(msg ...interface{})

Echo: Alias to fmt.Print

func EchoBreak

func EchoBreak(msg ...interface{})

Echo: Alias to fmt.Print, breaks new line in the end

func EmptyString

func EmptyString(s string) bool

EmptyString: if empty true; else false

func F32ti

func F32ti(f float32) int

Fti: FLOAT32 (Full) to INT; (May lost precision)

func F32ti64

func F32ti64(f float32) int64

F32ti64: FLOAT32 (Full) to INT64; (May lost precision)

func F32to64

func F32to64(f float32) float64

F32to64: Convert float32 to float64

func F32ts

func F32ts(f float32) string

F32ts: FLOAT32 (Full) to STRING

func F64ti

func F64ti(f float64) int
  • FLOAT to INT

Dti: FLOAT64 (Double) to INT; (May lost precision)

func F64ti64

func F64ti64(f float64) int64

Dti64: FLOAT64 (Double) to INT64; (May lost precision)

func F64to32

func F64to32(f float64) float32

F32to64: Convert float64 to float 32; lose precision

func F64ts

func F64ts(f float64) string
  • FLOAT to STRING

F64ts: FLOAT64 (Double) to STRING

func FileExists

func FileExists(file string) bool

func GetArch

func GetArch() string

func GetCustomTime

func GetCustomTime(expr string) string

GetCustomTime: User string expr to get datetime Y: year; M: month (numeric); L: month (written long); A: month (written short); D: day; H: hour; I: minute; S: second; N: Nanosecond;

func GetNow

func GetNow(databaseFormat bool) string

GetNow: Current full date with time; database ? YYYY-MM-DD HH:II:SS : DD/MM/YYYY HH:II:SS

func GetNumThreads

func GetNumThreads() int

func GetOS

func GetOS() string

func GetRoot

func GetRoot() string

func GetToday

func GetToday(databaseFormat bool) string

GetToday: Current full date; if database ? YYYY-MM-DD : DD/MM/YYYY

func GetType

func GetType(msg interface{}) string

func HasError

func HasError() (bool, string)

HasError: If error is true, Return true and all the error messages generate

func Hour

func Hour() string

Hour: Current hour as string

func I64td

func I64td(n int64) float64

Itd: INT64 to FLOAT64 (double)

func I64tf

func I64tf(n int64) float32

Itf: INT64 to FLOAT32 (full)

func IntToBin

func IntToBin(n int64) string

IntToBin: INT to BIN

func IntToHex

func IntToHex(n int64) string
  • INT to base 2, 8 e 16

IntToHex: INT to HEX

func IntToOct

func IntToOct(n int64) string

IntToOct: INT to OCT

func IsInt

func IsInt(s string) bool

func Itd

func Itd(n int) float64
  • INT to FLOAT

Itd: INT to FLOAT64 (double)

func Itf

func Itf(n int) float32

Itf: INT to FLOAT32 (full)

func Its

func Its(n int) string

Its: INT to STRING

func Its16

func Its16(n int16) string

Its16: INT16 to STRING

func Its32

func Its32(n int32) string

Its32: INT to STRING

func Its64

func Its64(n int64) string

Its64: INT64 to STRING

func Its8

func Its8(n int8) string
  • INT to STRING

Its8: INT8 to STRING

func LoadPerThread

func LoadPerThread(work int) int

func LogPath

func LogPath(path string) string

LogPath: Set path to save logs

func Lower

func Lower(s string) string

Lower: Alias to strings.ToLower

func Md5

func Md5(s string) string

func Minute

func Minute() string

Minute: Current minute as string

func Money32

func Money32(value float32, symbol bool) string

func Money64

func Money64(money float64, symbol bool) string

func MonthNum

func MonthNum() string

MonthNum: Current month in numeric format (return as string)

func MonthPtBR

func MonthPtBR() string

MonthPtBR: Current month in pr-BR (written long)

func Nanosecond

func Nanosecond() string

Nanosecond: Current nanosecond as string

func New

func New()

func Now

func Now() time.Time

Now: Alias to time.Time

func NowString

func NowString() string

NowString: Current date as STRING

func NowTimestamp

func NowTimestamp() int64

NowTimestamp: Current Timestamp (unix, INT64)

func NowUTC

func NowUTC() time.Time

NowUTC: Current datetime as UTC

func OnlyAlphaNumeric

func OnlyAlphaNumeric(text string) string

func OnlyNumber

func OnlyNumber(text string) string

func OnlyString

func OnlyString(text string) string

func OnlyStringAndSpace

func OnlyStringAndSpace(text string) string

func Panic

func Panic(e error)

Panic: Alias to panic; ignores if error == nil

func Print

func Print(msg ...interface{})

Print: Alias to fmt.Println

func PrintType

func PrintType(t ...interface{})

PrintType: Print var type in the terminal

func ReadFile

func ReadFile(path string) []byte

ReadFile: Reads... a file

func ReadFilesInDir

func ReadFilesInDir(path string) []string

func Regex

func Regex(text string, expr string, replace string) string

func Round32

func Round32(value float32) float32

func Round64

func Round64(value float64) float64

func RoundCeil32

func RoundCeil32(value float32) float32

func RoundCeil64

func RoundCeil64(value float64) float64

func RoundFloor32

func RoundFloor32(value float32) float32

func RoundFloor64

func RoundFloor64(value float64) float64

func Second

func Second() string

Second: Current second as string

func SeparateFileByLine

func SeparateFileByLine(file []byte) ([]string, int)

func SetNumThreads

func SetNumThreads(num int) int

func Sha1

func Sha1(s string) string

func Sha256

func Sha256(s string) string

func ShortMonthPtBR

func ShortMonthPtBR() string

ShortMonthPtBR: Current month in pr-BR (written short)

func StartErrorCheck

func StartErrorCheck()

StartErrorCheck: Remove anything from the check

func StayCalm

func StayCalm(e error) bool

StayCalm: Don't panic, if has error, just print error.Error() and return true

func Stb

func Stb(s string) []byte

Stb: STRING to []BYTE

func Stf64

func Stf64(s string) float64

Stf64: Tries to convert STRING to FLOAT64; checks for error

func Sti

func Sti(s string) int

Sti: Tries to convert STRING to INT; checks for error

func Sti16

func Sti16(s string) int16

Sti16: Tries to convert STRING to INT16; checks for error

func Sti32

func Sti32(s string) int

Sti32: Tries to convert STRING to INT32; checks for error

func Sti64

func Sti64(s string) int64

Sti64: Tries to convert STRING to INT64; checks for error

func Sti8

func Sti8(s string) int8
  • STRING to NUMBER

Sti8: Tries to convert STRING to INT8; checks for error

func Stui

func Stui(s string) uint

Stui: Tries to convert STRING to UINT ; checks for error

func Stui16

func Stui16(s string) uint16

Stui16: Tries to convert STRING to UINT16; checks for error

func Stui32

func Stui32(s string) uint

Stui32: Tries to convert STRING to UINT32; checks for error

func Stui64

func Stui64(s string) uint64

Sti64: Tries to convert STRING to INT64; checks for error

func Stui8

func Stui8(s string) uint8

Stui8: Tries to convert STRING to UINT8; checks for error

func ThreadPagination

func ThreadPagination(work int, threadID int) (int, int)

func Title

func Title(s string) string

Title: Alias to strings.Title

func ToString

func ToString(v interface{}) string

func Tts

func Tts(t time.Time) string

Dts: Return time.Time as STRING

func Uitd

func Uitd(n uint) float64

Uitd: UINT to FLOAT64 (double)

func Uitf

func Uitf(n uint) float32

Uitf: UINT to FLOAT32 (full)

func Uits

func Uits(n uint) string

Uits: UINT to STRING

func Uits16

func Uits16(n uint16) string

Uits16: UINT16 to STRING

func Uits32

func Uits32(n uint32) string

Uits32: UINT to STRING

func Uits64

func Uits64(n uint64) string

Uits64: INT64 to STRING

func Uits8

func Uits8(n uint8) string

Uits8: UINT8 to STRING

func Upper

func Upper(s string) string

Upper: Alias to strings.ToUpper

func Wait

func Wait(t time.Duration)

Wait: Alias to time.sleep()

func WriteBytesToFile

func WriteBytesToFile(file string, text []byte)

func WriteToFile

func WriteToFile(file string, text string)

func Year

func Year() string

Year: Current year

Types

type FileInfo

type FileInfo struct {
	Name     string
	Size     int64
	Dir      bool
	Modified time.Time
}

func ReadDir

func ReadDir(path string) []FileInfo

Jump to

Keyboard shortcuts

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