Documentation
¶
Index ¶
- func ChecksumEthereumAddress(addr string) string
- func ConnectArray(strList []string, connector string) string
- func ContainInArray[T comparable](target T, targetArray []T) bool
- func CryptoRandBelow(length int) int
- func CryptoRandBetween(start int, end int, times int) []int
- 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 OrderedNumber](x, y T) T
- func Min[T OrderedNumber](x, y T) T
- func PrettifyJson(raw string) string
- func PrettyJsonPrintln(obj any)
- func ReadCsv(filePath string) ([][]string, error)
- func ReadJsonSlice(path string) ([]string, error)
- func RemoveRepetitionInArray[T comparable](targetArray []T) []T
- func Restart(functionToRecover func(), functionName string)
- func SendMail(senderMail string, senderPassword string, senderHost string, senderPort string, ...) (err error)
- func SendTelegram(botToken string, chatId int64, text ...any) error
- func SimpleMarshal(obj any) []byte
- func SimpleStringify(obj any) string
- 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 ToAddress(input any) common_eth.Address
- func ToBigInt(input any) *big.Int
- func ToDecimal(input any) decimal.Decimal
- func ToFloat64(input any) float64
- func ToInt(input any) int
- func ToInt64(input any) int64
- func ToLowerString(input any) string
- func ToString(input any) string
- func WriteNewCsv(filePath string, title []string, text [][]string) error
- func WriteToCsv(filePath string, title []string, text []string) error
- type AddressTypes
- type BigNumber
- type Float
- type Integer
- type Number
- type Ordered
- type OrderedNumber
- type RobotAdapter
- type Signed
- type Unsigned
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChecksumEthereumAddress ¶
Return checksummed ethereum address.
func ConnectArray ¶
Connect the items in an array with "connector".
func ContainInArray ¶
func ContainInArray[T comparable](target T, targetArray []T) bool
func CryptoRandBetween ¶
Choose "times" different numbers between "start" and "end".
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 ¶
func Max[T OrderedNumber](x, y T) T
func Min ¶
func Min[T OrderedNumber](x, y T) T
func PrettifyJson ¶
func PrettyJsonPrintln ¶
func PrettyJsonPrintln(obj any)
func ReadJsonSlice ¶
func RemoveRepetitionInArray ¶
func RemoveRepetitionInArray[T comparable](targetArray []T) []T
func Restart ¶
func Restart(functionToRecover func(), functionName string)
Recover from panic and wait for a while.
func SendMail ¶ added in v0.0.2
func SendMail(senderMail string, senderPassword string, senderHost string, senderPort string, senderNickname string, receiver []string, subject, body string) (err error)
senderMail: mail address. senderPassword: sender email passord or token. senderHost: host, for example, "smtp.163.com". senderPort: port, for example, "465".
func SimpleMarshal ¶
func SimpleStringify ¶
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 ToAddress ¶
func ToAddress(input any) common_eth.Address
func ToLowerString ¶
func WriteNewCsv ¶
If file exist, will cover the old file.
Types ¶
type AddressTypes ¶
type AddressTypes interface {
string | common_eth.Address
}
type Number ¶
type Number interface {
OrderedNumber | BigNumber
}
type Ordered ¶
type Ordered interface {
OrderedNumber | ~string
}
type OrderedNumber ¶
type RobotAdapter ¶
func NewBot ¶
func NewBot(token string) (RobotAdapter, error)
func (*RobotAdapter) SendTelegram ¶
func (r *RobotAdapter) SendTelegram(chat_id int64, v ...any)
send telegram