utils

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(encrypted []byte, key []byte) (decrypted []byte)

*

  • @Description: AES解密
  • @param encrypted
  • @param key
  • @return decrypted

func AESEncrypt

func AESEncrypt(src []byte, key []byte) (encrypted []byte)

*

  • @Description: AES加密
  • @param src
  • @param key
  • @return encrypted

func Abs

func Abs(n int64) int64

*

  • @Description: 取绝对值
  • @param n
  • @return int64

func AppendBool

func AppendBool(a []bool, v bool, limit bool) []bool

*

  • @Description: 向前添加bool类型到数组
  • @param a 原数组
  • @param v 新值
  • @param limit 是否限制数组长度 false:增加长度 true:保持原有长度
  • @return []bool

func AppendFloat

func AppendFloat(a []float64, v float64, limit bool) []float64

*

  • @Description: 向前添加float类型到数组
  • @param a 原数组
  • @param v 新值
  • @param limit 是否限制数组长度 false:增加长度 true:保持原有长度
  • @return []float64

func AppendInt

func AppendInt(a []int64, v int64, limit bool) []int64

*

  • @Description: 向前添加int类型到数组
  • @param a 原数组
  • @param v 新值
  • @param limit 是否限制数组长度 false:增加长度 true:保持原有长度
  • @return []int64

func ArrayToString

func ArrayToString(array []string) string

*

  • @Description: 字符串数组转字符串
  • @param array 字符串数组
  • @return string 字符串

func BlueString

func BlueString(s string) string

*

  • @Description: 蓝色字符串
  • @param s
  • @return string

func CyanString

func CyanString(s string) string

*

  • @Description: 蓝绿色字符串
  • @param s
  • @return string

func DecryptString

func DecryptString(encrypted []byte) string

*

  • @Description: 解密字符串
  • @param encrypted
  • @return string

func EncryptString

func EncryptString(src []byte) string

*

  • @Description: 加密字符串
  • @param src
  • @return string

func Exists

func Exists(path string) bool

Exists

@Description: 判断所给路径文件/文件夹是否存在
@param path
@return bool

func GetBetweenDates

func GetBetweenDates(sdate, edate string) ([]string, error)

*

  • @Description: 根据开始日期和结束日期计算出时间段内所有日期 参数为日期格式,如:2020-01-01
  • @param sdate 开始日期
  • @param edate 结束日期
  • @return []string

func GetDiffDays

func GetDiffDays(startdate string, enddate string) int

*

  • @Description: 获取两个时间相差的天数,0表同一天,正数表t1>t2,负数表t1<t2
  • @param startdate 开始日期
  • @param enddate 结束日期
  • @return int

func GetFileByPath

func GetFileByPath(path string) ([]string, error)

*

  • @Description: 获取目录下所有文件名
  • @param path
  • @return []string
  • @return error

func GetGoogleToken

func GetGoogleToken(secret string) string

获取谷歌验证器code

func GreenString

func GreenString(s string) string

*

  • @Description: 绿色字符串
  • @param s
  • @return string

func IsDir

func IsDir(path string) bool

IsDir

@Description: 判断所给路径是否为文件夹
@param path
@return bool

func IsFile

func IsFile(path string) bool

IsFile

@Description: 判断所给路径是否为文件
@param path
@return bool

func IsFileExists

func IsFileExists(filename string) bool

*

  • @Description: 判断文件是否存在
  • @param filename 文件名
  • @return error

func IsInArray

func IsInArray(value string, array []string) bool

*

  • @Description: 判断值是否在数组里
  • @param value 值
  • @param array 数组
  • @return bool 结果

func IsKlineExists

func IsKlineExists(klines []common.Kline, symbol string, timestamp int64) bool

*

  • @Description: 判断Kline原素是否存在
  • @param klines
  • @param symbol
  • @param timestamp
  • @return bool

func MagentaString

func MagentaString(s string) string

*

  • @Description: 洋红色字符串
  • @param s
  • @return string

func ReadLine

func ReadLine(fileName string) ([]string, error)

读取文件

func RedString

func RedString(s string) string

*

  • @Description: 红色字符串
  • @param s
  • @return string

func ValidLimitPrice

func ValidLimitPrice(price float64, last common.LastPrice) float64

*

  • @Description: 将价格限定在涨跌停版以内
  • @param price
  • @param last
  • @return float64

func YellowString

func YellowString(s string) string

*

  • @Description: 黄色字符串
  • @param s
  • @return string

Types

This section is empty.

Jump to

Keyboard shortcuts

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