Documentation ¶
Index ¶
- func Apr2Apy[T types.Number](apr T) (apy float64)
- func Apr2ApyWithCompoundTimes[T types.Number, S types.Number](apr T, compoundTimes S) (apy float64)
- func Apy2Apr[T types.Number](apy T) (apr float64)
- func Apy2AprWithCompoundTimes[T types.Number, S types.Number](apy T, compoundTimes S) (apr float64)
- func ChecksumEthereumAddress(addr string) string
- func ConnectArray(strList []string, connector string) string
- func ContainAnyOfStrs(str string, subStrs []string) bool
- func ContainInArray[T comparable](target T, array []T) bool
- func ContainInArrayX(target string, array []string) bool
- func CreateKey() (privateKey string, address string)
- func CryptoRandBelow(length int) int
- func CryptoRandBetween(start int, end int, times int) []int
- func FindBytesBetween(fullBytes []byte, bytesBefore []byte, bytesAfter []byte) (target [][]byte)
- func FindStringBetween(fullStr string, strBefore string, strAfter string) (target []string)
- func FormatJson(obj any) string
- func FormatJsonByte(obj any) []byte
- func GetMonthStart(location string) time.Time
- func GetStringHash(input string) string
- func GetTimeByStr(str string, location string) time.Time
- func GetTimeRangeByType(t string, location string) (start int64, end int64)
- func GetTodayStart(location string) time.Time
- func GetWeekStart(location string) time.Time
- func GetYearStart(location string) time.Time
- func MathRandBelow(length int) int
- func Max[T types.OrderedNumber](numbers ...T) T
- func Min[T types.OrderedNumber](numbers ...T) T
- func PrettifyJson(raw string) string
- func PrettyJsonPrintln(obj any)
- func ReadCsv(filePath string) ([][]string, error)
- func ReadJsonSlice(path string) ([]string, error)
- func RemoveFromArray[T comparable](array []T, toRemove T) []T
- func RemoveFromString(str string, subStr string) string
- func RemoveRepetitionInArray[T comparable](array []T) []T
- func Restart(functionToRecover func(), functionName string)
- func RestartAndSleep(functionToRecover func(), functionName string, sleepTime time.Duration)
- func RunFuncName() string
- func SendMail(sender MailSender, info MailInfo) error
- func SendTelegramSimple(botToken string, chatId int64, text string) error
- func SeperateIntoArray(targetStr string, seperateBy string) (res []string)
- func SimpleMarshal(obj any) []byte
- func SimpleStringify(obj any) string
- func StringToTrueLocations(str string) []int64
- func Stringify(obj any) string
- func TimeFormat(timestamp int64, location string) string
- func TimeFormatTime(timestamp int64, location string) time.Time
- func TimeNowString() string
- func TimestampNow() int
- func TrueLocationsToString(trueLocs []int64) string
- func WriteNewCsv(filePath string, title []string, text [][]string) error
- func WriteToCsv(filePath string, title []string, text []string) error
- func WriteToCsvResume(filePath string, title []string, text []string, noRepeatTitle string) error
- type MailInfo
- type MailSender
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apr2ApyWithCompoundTimes ¶ added in v0.0.5
Input 0.01 for 1%.
func Apy2AprWithCompoundTimes ¶ added in v0.0.5
Input 0.01 for 1%.
func ChecksumEthereumAddress ¶
Return checksummed ethereum address.
func ConnectArray ¶
Connect the items in an array with "connector".
func ContainAnyOfStrs ¶
func ContainInArray ¶
func ContainInArray[T comparable](target T, array []T) bool
If target contains in array.
func ContainInArrayX ¶ added in v0.0.6
If target contains in string array, ignore lower or upper.
func CryptoRandBetween ¶
Choose "times" different numbers between "start" and "end".
func FindBytesBetween ¶
Find all []byte between "bytesBefore" and "bytesAfter".
Used to seperate a long []byte into ideal array.
func FindStringBetween ¶
Find all string between "strBefore" and "strAfter".
Used to seperate a long string into ideal array.
func FormatJson ¶
func FormatJsonByte ¶
func GetMonthStart ¶
If location is "" or "UTC", use UTC time.
If location is "Local", use local time.
Location can also be "America/New_York", "Asia/Shanghai", etc.
func GetStringHash ¶
For example: "TraderJoeSupplyEvent(address,address,uint256,address)".
Space must not be included.
func GetTimeByStr ¶
If location is "" or "UTC", use UTC time.
If location is "Local", use local time.
Location can also be "America/New_York", "Asia/Shanghai", etc.
func GetTimeRangeByType ¶
If location is "" or "UTC", use UTC time.
If location is "Local", use local time.
Location can also be "America/New_York", "Asia/Shanghai", etc.
func GetTodayStart ¶
If location is "" or "UTC", use UTC time.
If location is "Local", use local time.
Location can also be "America/New_York", "Asia/Shanghai", etc.
func GetWeekStart ¶
If location is "" or "UTC", use UTC time.
If location is "Local", use local time.
Location can also be "America/New_York", "Asia/Shanghai", etc.
func GetYearStart ¶
If location is "" or "UTC", use UTC time.
If location is "Local", use local time.
Location can also be "America/New_York", "Asia/Shanghai", etc.
func Max ¶ added in v0.0.4
func Max[T types.OrderedNumber](numbers ...T) T
func Min ¶ added in v0.0.4
func Min[T types.OrderedNumber](numbers ...T) T
func PrettifyJson ¶
func PrettyJsonPrintln ¶
func PrettyJsonPrintln(obj any)
func ReadJsonSlice ¶
func RemoveFromArray ¶
func RemoveFromArray[T comparable](array []T, toRemove T) []T
Remove sth from an array and return the new one.
func RemoveFromString ¶
Remove the first subStr in str.
func RemoveRepetitionInArray ¶
func RemoveRepetitionInArray[T comparable](array []T) []T
Remove repetiton in an array and return the new one.
func Restart ¶
func Restart(functionToRecover func(), functionName string)
Recover from panic and restart.
func RestartAndSleep ¶
Recover from panic and restart after waiting for a while.
func SendMail ¶ added in v0.0.7
func SendMail(sender MailSender, info MailInfo) error
func SendTelegramSimple ¶ added in v0.0.7
Can only send string text.
func SeperateIntoArray ¶
Seperate a string into an array, the seperater will be deleted.
func SimpleMarshal ¶
func SimpleStringify ¶
func StringToTrueLocations ¶
Consider a map: map[loc]=bool.
Convert the coded string into locations.
func TimeFormat ¶
If location is "" or "UTC", use UTC time.
If location is "Local", use local time.
Location can also be "America/New_York", "Asia/Shanghai", etc.
func TimeFormatTime ¶
If location is "" or "UTC", use UTC time.
If location is "Local", use local time.
Location can also be "America/New_York", "Asia/Shanghai", etc.
func TimeNowString ¶
func TimeNowString() string
func TimestampNow ¶
func TimestampNow() int
func TrueLocationsToString ¶
Consider a map: map[loc]=bool.
Use a bigInt to locate all true locations and convert into string.
func WriteNewCsv ¶
If file exist, will cover the old file.
func WriteToCsv ¶
Write to csv line by line.