Documentation
ΒΆ
Index ΒΆ
- func CheckErrors(errChecks ...ErrorFunc) error
- func FloatToString(val float64) string
- func FormatDuration(duration time.Duration) string
- func GetRandomInt(max int) int
- func GetRandomString(length int) string
- func GetValuePrecision(val float64) int
- func HttpGET(url string) ([]byte, error)
- func IntArrContains(a []int64, x int64) bool
- func IntArrFind(a []int64, x int64) int
- func IsFileExists(filepath string) bool
- func MD5(val []byte) string
- func ParseConfigFromEnv(cfgPointer any) error
- func ParseStructFromJSON(jsonBytes []byte, destinationPointer interface{}) error
- func ParseStructFromJSONFile(filepath string, destinationPointer interface{}) error
- func ParseStructFromYaml(jsonBytes []byte, destinationPointer interface{}) error
- func ParseStructFromYamlFile(filepath string, destinationPointer interface{}) error
- func PrintIntroMessage(appName, cryptoAddress string, cryptoCoinTag ...string)
- func PrintObject(o any)
- func ReadFile(filepath string) ([]byte, error)
- func ReadFileLines(filePath string) ([]string, error)
- func ReadFileToBytes(filepath string) ([]byte, error)
- func ReadFileToString(filepath string) (string, error)
- func Reconnect(task ReconnectTask)
- func RunInBackground()
- func SaveStringToFile(filepath string, content string) error
- func SaveStructToJSONFile(i interface{}, filepath string) error
- func SaveStructToJSONFileIndent(i interface{}, filepath string) error
- func SaveStructToYamlFile(i interface{}, filepath string) error
- func Ternary(statement bool, a, b interface{}) interface{}
- func WaitForAppFinish()
- type ChannelWorker
- type ConnFunc
- type ErrorFunc
- type ReconnectTask
Constants ΒΆ
This section is empty.
Variables ΒΆ
This section is empty.
Functions ΒΆ
func CheckErrors ΒΆ added in v1.0.1
CheckErrors - check some errors
func FloatToString ΒΆ added in v1.0.3
FloatToString - convert float to string
func FormatDuration ΒΆ added in v1.0.4
FormatDuration - format duration 52h -> "2 days 4 hours"
func GetRandomInt ΒΆ added in v1.0.8
GetRandomInt returns non-negative pseudo-random number in the half-open interval [0,max)
func GetRandomString ΒΆ added in v1.0.7
GetRandomString - superfast string generation. 139 ns/op 32 B/op 2 allocs/op. topic: https://stackoverflow.com/questions/22892120/how-to-generate-a-random-string-of-a-fixed-length-in-go
func GetValuePrecision ΒΆ
GetValuePrecision - find out the precision of the numeric value
func IntArrContains ΒΆ
IntArrContains indicates whether x is contained in a.
func IntArrFind ΒΆ
IntArrFind find element index in arr. -1 if not found
func IsFileExists ΒΆ added in v1.1.0
IsFileExists - check file exists
func ParseConfigFromEnv ΒΆ added in v1.8.2
func ParseStructFromJSON ΒΆ added in v1.1.0
func ParseStructFromJSONFile ΒΆ added in v1.1.0
func ParseStructFromYaml ΒΆ added in v1.8.1
func ParseStructFromYamlFile ΒΆ added in v1.8.1
func PrintIntroMessage ΒΆ added in v1.3.0
PrintIntroMessage - publishes a funny message in the log asking to donate to the developer
func PrintObject ΒΆ added in v1.9.2
func PrintObject(o any)
func ReadFileLines ΒΆ added in v1.0.5
ReadFileLines - read file to lines
func ReadFileToBytes ΒΆ added in v1.1.0
ReadFileToString read file to bytes
func ReadFileToString ΒΆ
ReadFileToString read file to string
func SaveStringToFile ΒΆ
SaveStringToFile save arbitrary string to file
func SaveStructToJSONFile ΒΆ
SaveStructToJSONFile save structure to JSON file
func SaveStructToJSONFileIndent ΒΆ added in v1.7.0
SaveStructToJSONFileIndent save structure to JSON file
func SaveStructToYamlFile ΒΆ added in v1.8.0
SaveStructToYamlFile save structure to YAML file (in plain text)
func Ternary ΒΆ
func Ternary(statement bool, a, b interface{}) interface{}
Ternary operator. conditional operator usage example: var res = ternary(val > 0, "positive", "negative")
func WaitForAppFinish ΒΆ added in v1.9.0
func WaitForAppFinish()
Types ΒΆ
type ChannelWorker ΒΆ added in v1.0.6
type ChannelWorker struct { MaxCapacity int Events chan interface{} EventHandlerCallback func(event interface{}) ProcessingEvents bool IsFinished bool // contains filtered or unexported fields }
func NewChannelWorker ΒΆ added in v1.0.6
func NewChannelWorker(callback func(event interface{}), maxCapacity int) *ChannelWorker
func (*ChannelWorker) AddEvent ΒΆ added in v1.0.6
func (w *ChannelWorker) AddEvent(event interface{})
func (*ChannelWorker) GetMessagesAvailableCount ΒΆ added in v1.0.6
func (w *ChannelWorker) GetMessagesAvailableCount() int
func (*ChannelWorker) SetAsync ΒΆ added in v1.2.0
func (w *ChannelWorker) SetAsync(asyncMode bool) *ChannelWorker
func (*ChannelWorker) Start ΒΆ added in v1.0.6
func (w *ChannelWorker) Start()
Start handle events NOTE: it's blocking method
func (*ChannelWorker) Stop ΒΆ added in v1.0.6
func (w *ChannelWorker) Stop()