Documentation
¶
Index ¶
- Constants
- Variables
- func AddressToBinary(address string) ([]byte, error)
- func AppendHexStrings(values ...string) string
- func Base64Encode(data []byte) string
- func BuildUri(urlString string, queries map[string]string) string
- func ContentHtmlByUrl(link string) string
- func ConvertImageDataURL(tokenURL string) string
- func ConvertJsonObject(jsonStr string, data interface{}) error
- func ConvertJsonString(data interface{}) string
- func Copy(toValue interface{}, fromValue interface{}) (err error)
- func CopyWithOption(toValue interface{}, fromValue interface{}, opt Option) (err error)
- func CrawlUrl(urlToCrawl string) string
- func CurlBase64String(apiURL string) (string, error)
- func CurlURL(apiURL string, method string, headers map[string]string, postData interface{}, ...) error
- func CurlURLString(apiURL string, method string, headers map[string]string, postData interface{}) (string, error)
- func Decrypt(dataStr, privKey string, result interface{}) error
- func ERC20PermitSignature(pk *ecdsa.PrivateKey, domainSeparator, owner, spender common.Address, ...) (byte, [32]byte, [32]byte, error)
- func Encrypt(data interface{}, privKey string) (string, error)
- func EncryptAndSignAuthToken(authToken AuthToken, serverKey string) (string, error)
- func EncryptAuthToken(authToken AuthToken, serverKey string) (string, error)
- func ExpansionStringArray(arr []string) []string
- func ExtensionsByContentType(contentType string) (string, error)
- func ExtractDomainFromUrl(link string) (string, error)
- func ExtractEVMAddress(input string) string
- func ExtractEtherAddress(content string) string
- func ExtractLinks(content string) (string, bool)
- func ExtractMapInfoFromOpenAI(content string) map[string]interface{}
- func ExtractTweetID(link string) string
- func FormatMoney(amount *big.Float) string
- func GenShareCode(length int) string
- func GenerateMD5(v string) string
- func GenerateTemplateContent(templateContent string, data interface{}) (string, error)
- func GetAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity *big.Int) *big.Int
- func GetAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity *big.Int) *big.Int
- func GetAmountsForLiquidity(sqrtRatioCurrentX96, sqrtRatioAX96, sqrtRatioBX96, liquidity *big.Int) (*big.Int, *big.Int)
- func GetDurationUnit(unit uint8) string
- func GetExternalPrice(tokenSymbol string) (string, error)
- func GetFileExtension(fileName string) string
- func GetFrequencyFromMap(mapInfo map[string]interface{}) int
- func GetLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0 *big.Int) *big.Int
- func GetLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1 *big.Int) *big.Int
- func GetLiquidityForAmounts(sqrtRatioCurrentX96, sqrtRatioAX96, sqrtRatioBX96, amount0, amount1 *big.Int) *big.Int
- func GetNextScheduleTime(interval time.Duration, delay time.Duration) *time.Time
- func GetNumberFromString(strText string) int
- func GetSignMsg(msg string) string
- func GetSqrtRatioAtTick(tick int64) *big.Int
- func GetStartDayOfMonth(t time.Time) time.Time
- func GetStartDayOfWeek(t time.Time) time.Time
- func GetStringValueFromMap(mapInfo map[string]interface{}, key string) string
- func GetTimeIndex(blockNumber, txIndex, logIndex uint) uint64
- func GetTokenIDFromMap(mapInfo map[string]interface{}) uint64
- func HexToAddress(address string) common.Address
- func HexToBigInt(s string) *big.Int
- func HexToHash(hashHex string) common.Hash
- func HttpRequest(fullUrl string, method string, headers map[string]string, reqBody interface{}) ([]byte, *http.Header, int, error)
- func HttpRequestFullResponse(fullUrl string, method string, headers map[string]string, reqBody interface{}) ([]byte, *http.Header, int, error)
- func IsValidEthereumAddress(address string) bool
- func JsonRequest(fullUrl string, method string, headers map[string]string, reqBody io.Reader) ([]byte, *http.Header, int, error)
- func MakeSeoURL(title string) string
- func MergeMetaInfoURL(baseURL string, mediaURL string) string
- func MinifyHTML(html string) (string, error)
- func NewDate(day int, month time.Month, year int) *time.Time
- func NewDateForDayOfWeek(dayOffWeek time.Weekday, month time.Month, year int, number int) *time.Time
- func NewLastDateForDayOfWeek(dayOffWeek time.Weekday, month time.Month, year int) *time.Time
- func NewNearbyDayOfMonthAt(t *time.Time, dayOffMonth int) *time.Time
- func NewNearbyDayOfWeekAt(t *time.Time, dayOffWeek time.Weekday) *time.Time
- func ParseAddress2Hex(v string) string
- func ParseBigInt2Hex(v *big.Int) string
- func ParseGasFeeError(errText string) (*big.Int, error)
- func ParseHex2Hex(v string) string
- func ParseNumber2Hex(v string) string
- func ParseStringToDateDefault(value string) *time.Time
- func ParseStringToDateTimeDefault(value string) *time.Time
- func ParseStringToDateTimeTwitter(value string) *time.Time
- func ParseStringToFilterDateDefault(value string) *time.Time
- func ParseStringToTime(layout string, value string) *time.Time
- func ParseTimeToString(layout string, value *time.Time) string
- func ParseTimeToStringDateDefault(value *time.Time) string
- func ParseTimeToStringDateTimeDefault(value *time.Time) string
- func PostThreadTweetByToken(accessToken string, messages []string) (string, error)
- func PostTweetByToken(accessToken, message string, replyID string) (string, error)
- func PostTweetWithMediaByToken(accessToken, message string, mediaID string) (string, error)
- func PriceToTick(price float64) int64
- func QuoteTweetByToken(bearerToken string, content string, quoteTweetId string) (string, error)
- func RandHash() string
- func RandInArray(arry []string) string
- func RandomBigInt(numBytes int) *big.Int
- func RandomFloat(from, to float64) float64
- func RandomHex(n int) (string, error)
- func RandomInStrings(values []string) string
- func RandomInt(from, to int) int
- func RandomNonceNumber(numberOfDigits int) (string, error)
- func RandomReferralCode(length int) string
- func RandomSeoURLWithLength(length int) string
- func RandomStringWithLength(length int) string
- func ReadCSVFromUrl(url string) ([][]string, error)
- func RemoveImageURLs(text string) string
- func RemoveTrailingHashTag(line string) string
- func RemoveURLs(text string) string
- func ReplaceQuote(obj string) string
- func ReplyTweetByToken(bearerToken string, replyContent string, tweetID, mediaID string) (string, error)
- func RepostTweetByToken(bearerToken string, userID string, tweetID string) (string, error)
- func RodContentHtmlByUrl(rawUrl string) string
- func Sha256ToNonce(s string) *big.Int
- func Sign(dataStr, privKey string) (string, error)
- func SignAuthToken(authTokenStr, privateKey string) (string, error)
- func SimpleAddress(hexAddress string) string
- func SlackGameAlert(content string) error
- func SlackHook(slackURL, channel, content string) error
- func SliceToStrings(from, len int, getValueAtIndex func(index int) (string, error)) ([]string, error)
- func SplitAuthToken(authToken string) (string, string)
- func SplitTextByCharLimit(text string, limit int) []string
- func SplitTextBySentenceAndCharLimitAndRemoveTrailingHashTag(originText string, limit int) []string
- func SubStringBodyResponse(obj string, limit int) string
- func TimeAdd(t time.Time, d time.Duration) *time.Time
- func TimeFromUnix(n int64) *time.Time
- func TimeNow() *time.Time
- func TimeNowAdd(d time.Duration) *time.Time
- func ToWorkHours(t1 *time.Time, t2 *time.Time) float64
- func TruncateDate(toRound time.Time) time.Time
- func TwitterFollowUserCreate(accessToken, twitterId string, targetTwitterId string) error
- func ValidateMessageSignature(msg string, signatureHex string, signer string) error
- func ValidateRecaptcha(secret string, response string) (bool, error)
- func VerifyAuthToken(authTokenStr, signature, address string) error
- func VerifySig(dataHash []byte, sig64, address string) error
- func VerifySignature(fromAddress, signatureHex, message string) error
- type AllowedCode
- type AuthToken
- type BinancePrice
- type BinancePrice24h
- type CoincodexPrice
- type FieldNameMapping
- type LikedTweetsResponse
- type NakaChainPrice
- type Option
- type RelyError
- type RelyErrorMessage
- type TwitterNotification
- type TwitterUserMe
- type TypeConverter
Constants ¶
View Source
const ( // Some default converter types for a nicer syntax String string = "" Bool bool = false Int int = 0 Float32 float32 = 0 Float64 float64 = 0 )
These flags define options for tag handling
View Source
const ( DEFAULT_DATE_FORMAT = "2006-01-02" DEFAULT_TIME_FORMAT = "2006-01-02 15:04:05" TWITTER_DATE_TIME_FORMAT = "2006-01-02T15:04:05.000Z" DEFAULT_TIME_ONLY_FORMAT = "15:04:05" DEFAULT_FILTER_TIME_FORMAT = "20060102150405" )
Variables ¶
View Source
var ( ErrInvalidCopyDestination = errors.New("copy destination must be non-nil and addressable") ErrInvalidCopyFrom = errors.New("copy from must be non-nil and addressable") ErrMapKeyNotMatch = errors.New("map's key type doesn't match") ErrNotSupported = errors.New("not supported") ErrFieldNameTagStartNotUpperCase = errors.New("copier field name tag must be start upper case") )
View Source
var ( Q128 = big.NewInt(1).Lsh(big.NewInt(1), 128) Q96 = big.NewInt(1).Lsh(big.NewInt(1), 96) Q32 = big.NewInt(1).Lsh(big.NewInt(1), 32) MIN_TICK = big.NewInt(-887272) MAX_TICK = new(big.Int).Neg(MIN_TICK) MAX_UINT256 = new(big.Int).Sub( new(big.Int).Exp(big.NewInt(2), big.NewInt(256), nil), big.NewInt(1), ) )
Functions ¶
func AddressToBinary ¶
func AppendHexStrings ¶
func Base64Encode ¶
func ContentHtmlByUrl ¶
func ConvertImageDataURL ¶
func ConvertJsonObject ¶
func ConvertJsonString ¶
func ConvertJsonString(data interface{}) string
func CopyWithOption ¶
CopyWithOption copy with option
func CurlBase64String ¶
func CurlURLString ¶
func ERC20PermitSignature ¶
func ERC20PermitSignature(pk *ecdsa.PrivateKey, domainSeparator, owner, spender common.Address, value, nonce, deadline *big.Int) (byte, [32]byte, [32]byte, error)
get v, r, s variables from eip712 signature for permit function
func EncryptAndSignAuthToken ¶
func EncryptAuthToken ¶
func ExpansionStringArray ¶
func ExtensionsByContentType ¶
func ExtractDomainFromUrl ¶
func ExtractEVMAddress ¶
func ExtractEtherAddress ¶
func ExtractLinks ¶
func ExtractTweetID ¶
func FormatMoney ¶
func GenShareCode ¶
func GenerateMD5 ¶
func GenerateTemplateContent ¶
func GetAmount0ForLiquidity ¶
func GetAmount1ForLiquidity ¶
func GetAmountsForLiquidity ¶
func GetDurationUnit ¶
func GetExternalPrice ¶
func GetFileExtension ¶
func GetFrequencyFromMap ¶
func GetLiquidityForAmount0 ¶
func GetLiquidityForAmount1 ¶
func GetLiquidityForAmounts ¶
func GetNextScheduleTime ¶
func GetNumberFromString ¶
func GetSignMsg ¶
func GetSqrtRatioAtTick ¶
func GetStringValueFromMap ¶
func GetTimeIndex ¶
func GetTokenIDFromMap ¶
func HexToAddress ¶
func HexToBigInt ¶
func HttpRequest ¶
func HttpRequestFullResponse ¶
func IsValidEthereumAddress ¶
func JsonRequest ¶
func MakeSeoURL ¶
func MergeMetaInfoURL ¶
func MinifyHTML ¶
func NewDateForDayOfWeek ¶
func NewLastDateForDayOfWeek ¶
func NewNearbyDayOfWeekAt ¶
func ParseAddress2Hex ¶
func ParseBigInt2Hex ¶
func ParseHex2Hex ¶
func ParseNumber2Hex ¶
func PostThreadTweetByToken ¶
func PostTweetByToken ¶
func PriceToTick ¶
func QuoteTweetByToken ¶
func RandInArray ¶
func RandomBigInt ¶
func RandomFloat ¶
func RandomInStrings ¶
func RandomNonceNumber ¶
func RandomReferralCode ¶
func RandomSeoURLWithLength ¶
func RandomStringWithLength ¶
func ReadCSVFromUrl ¶
func RemoveImageURLs ¶
func RemoveTrailingHashTag ¶
func RemoveURLs ¶
func ReplaceQuote ¶
func ReplyTweetByToken ¶
func RepostTweetByToken ¶
func RodContentHtmlByUrl ¶
func Sha256ToNonce ¶
func SignAuthToken ¶
func SimpleAddress ¶
func SlackGameAlert ¶
func SliceToStrings ¶
func SplitAuthToken ¶
func SplitTextByCharLimit ¶
func SplitTextBySentenceAndCharLimitAndRemoveTrailingHashTag ¶
SplitTextBySentenceAndCharLimit splits text into lines by sentence boundaries and a character limit per line.
func SubStringBodyResponse ¶
func TimeFromUnix ¶
func TwitterFollowUserCreate ¶
func VerifyAuthToken ¶
func VerifySignature ¶
Types ¶
type AllowedCode ¶
func NewAllowedCode ¶
func NewAllowedCode() AllowedCode
type AuthToken ¶
type AuthToken struct { Address string `json:"address"` Exp int64 `json:"exp"` SessionID string `json:"session_id"` }
func DecryptAuthToken ¶
type BinancePrice ¶
func GetListExternalPrice ¶
func GetListExternalPrice(tokenSymbol string) ([]BinancePrice, error)
type BinancePrice24h ¶
type BinancePrice24h struct { Symbol string `json:"symbol"` LastPrice string `json:"lastPrice"` PriceChange string `json:"priceChange"` PriceChangePercent string `json:"priceChangePercent"` WeightedAvgPrice string `json:"weightedAvgPrice"` PrevClosePrice string `json:"prevClosePrice"` LastQty string `json:"lastQty"` BidPrice string `json:"bidPrice"` BidQty string `json:"bidQty"` AskQty string `json:"askQty"` OpenPrice string `json:"openPrice"` HighPrice string `json:"highPrice"` LowPrice string `json:"lowPrice"` Volume string `json:"volume"` QuoteVolume string `json:"quoteVolume"` OpenTime int64 `json:"openTime"` CloseTime int64 `json:"closeTime"` }
func GetBinancePrice24h ¶
func GetBinancePrice24h(tokenSymbol string) (BinancePrice24h, error)
func GetListExternalPrice24h ¶
func GetListExternalPrice24h(tokenSymbol string) ([]BinancePrice24h, error)
type CoincodexPrice ¶
type CoincodexPrice struct { Symbol string `json:"symbol"` LastPriceUsd float64 `json:"last_price_usd"` DisplaySymbol string `json:"display_symbol"` }
//////////
func GetCoincodexPriceByTime ¶
func GetCoincodexPriceByTime(monthStr string) ([]*CoincodexPrice, error)
type FieldNameMapping ¶
type LikedTweetsResponse ¶
type LikedTweetsResponse struct { Data []struct { ID string `json:"id"` Text string `json:"text"` } `json:"data"` Meta struct { NextToken string `json:"next_token"` } `json:"meta"` }
Response structure for liked tweets
func GetLikedTweets ¶
func GetLikedTweets(userID string, bearerToken string, nextToken string) (*LikedTweetsResponse, error)
Function to fetch liked tweets
type NakaChainPrice ¶
type NakaChainPrice struct { Result *struct { ETH string `json:"eth,omitempty"` BTC string `json:"btc,omitempty"` EAI string `json:"eai,omitempty"` BVM string `json:"bvm,omitempty"` RUNIX string `json:"runix,omitempty"` NAKA string `json:"naka,omitempty"` } `json:"result"` }
func GetNakaChainMarketPrice ¶
func GetNakaChainMarketPrice() (*NakaChainPrice, error)
type Option ¶
type Option struct { // setting this value to true will ignore copying zero values of all the fields, including bools, as well as a // struct having all it's fields set to their zero values respectively (see IsZero() in reflect/value.go) IgnoreEmpty bool CaseSensitive bool DeepCopy bool Converters []TypeConverter // Custom field name mappings to copy values with different names in `fromValue` and `toValue` types. // Examples can be found at `TestCustomFieldName`. FieldNameMapping []FieldNameMapping }
Option sets copy options
type RelyErrorMessage ¶
type TwitterNotification ¶
type TwitterNotification struct { Data []struct { ID string `json:"id"` Text string `json:"text"` } `json:"data"` }
func GetTwitterNotifications ¶
func GetTwitterNotifications(accessToken, userID string) (*TwitterNotification, error)
type TwitterUserMe ¶
type TwitterUserMe struct { Data *struct { ID string `json:"id"` Name string `json:"name"` UserName string `json:"username"` CreatedAt string `json:"created_at"` Description string `json:"description"` Location string `json:"location"` PinnedTweetID string `json:"pinned_tweet_id"` ProfileImageURL string `json:"profile_image_url"` Protected bool `json:"protected"` URL string `json:"url"` Verified bool `json:"verified"` } `json:"data"` }
func GetTwitterUserMe ¶
func GetTwitterUserMe(accessToken string) (*TwitterUserMe, error)
type TypeConverter ¶
type TypeConverter struct { SrcType interface{} DstType interface{} Fn func(src interface{}) (dst interface{}, err error) }
Click to show internal directories.
Click to hide internal directories.