utils

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SYSTEM_NAME                                              = "SYSTEM"
	LIVE_INTERVAL_STRUCTURED_VALUE_ID                        = 58
	DAILY_STRUCTURED_VALUE_ID                                = 5
	FIAT_STRUCTURED_VALUE_ID                                 = 9
	ASSET_PAIR_STRUCTURED_VALUE_ID                           = 12
	USD_ID                                                   = 34
	LIVE_DATA_MARKET_DATA_TYPE_STRUCTURED_VALUE_ID           = 7
	END_OF_DAY_MARKET_DATA_TYPE_STRUCTURED_VALUE_ID          = 8
	COINGECKO_SOURCE_ID                                      = 3
	JOB_STATUS_STRUCTURED_VALUE_TYPE_ID                      = 14
	SUCCESS_STRUCTURED_VALUE_ID                              = 52
	RUNNING_STRUCTURED_VALUE_ID                              = 53
	WARNING_STRUCTURED_VALUE_ID                              = 54
	FAILED_STRUCTURED_VALUE_ID                               = 55
	JOB_CATEGORY_STRUCTURED_VALUE_TYPE_ID                    = 15
	LIVE_JOB_CATEGORY_STRUCTURED_VALUE_ID                    = 56
	EOD_JOB_CATEGORY_STRUCTURED_VALUE_ID                     = 57
	BIG_INT_EXP                                              = 18
	STRATEGY_STRUCTURED_VALUE_TYPE_ID                        = 16
	FREQUENCY_STRUCTURED_VALUE_TYPE_ID                       = 17
	STEP_ACTION_TYPE_STRUCTURED_VALUE_TYPE_ID                = 18
	HARVESTING_FREQUENCY_STRUCTURED_VALUE_ID                 = 73
	STRATEGY_MARKET_DATA_IMPORT_JOB_TYPE_STRUCTURED_VALUE_ID = 74
	STRATEGY_SNAPSHOT_MARKET_DATA_TYPE_STRUCTURED_VALUE_ID   = 75
	STRATEGY_EXEUCTION_JOB_TYPE_STRUCTURED_VALUE_ID          = 76
)
View Source
const (
	LayoutISO       = "2006-01-02"
	LayoutUS        = "January 2, 2006"
	LayoutPostgres  = "2006-01-02 15:04:05"
	LayoutCoingecko = "02-01-2006"
	LayoutRFC3339   = "2016-06-20T12:41:45.140Z"
	TimeFormat      = "15:04:05"
)

Variables

This section is empty.

Functions

func AccessSecretVersion

func AccessSecretVersion(name string) (string, error)

accessSecretVersion accesses the payload for the given secret version if one exists. The version can be a version number as a string (e.g. "5") or an alias (e.g. "latest").

func CheckIfStringPrefixExistsInArray

func CheckIfStringPrefixExistsInArray(arr []string, val string) bool

func ConvertDateToUTCZero

func ConvertDateToUTCZero(t time.Time) time.Time

func ConvertFloatToDecimal

func ConvertFloatToDecimal(value *float64) *decimal.Decimal

func ConvertFloatToPgTypeNumeric

func ConvertFloatToPgTypeNumeric(value *float64) *pgtype.DataType

func EndDate

func EndDate(t time.Time) time.Time

func EndOfMonthDate

func EndOfMonthDate(t time.Time) time.Time

func GetEnv

func GetEnv() string

func GoDotEnvVariable

func GoDotEnvVariable(key string) string

use godot package to load/read the .env file and return the value of the key

func IndexOfInts

func IndexOfInts(arr []int, val int) int

func IndexOfStrings

func IndexOfStrings(arr []string, val string) int

func LookupEnv added in v1.0.21

func LookupEnv(k string) string

func MustGetenv

func MustGetenv(k string) string

func OffsetDateByDay

func OffsetDateByDay(t time.Time, offsetDay *int) time.Time

func ParseStringToDate

func ParseStringToDate(s string, layout string) (time.Time, error)

func RandomString

func RandomString(length int) string

func RandomStringWithCharset

func RandomStringWithCharset(length int, charset string) string

func RangeDate

func RangeDate(start, end time.Time) func() time.Time

func RangeDateMonthly

func RangeDateMonthly(start, end time.Time) func() time.Time

func RangeDateOffsetByDate

func RangeDateOffsetByDate(start, end time.Time, offSetDays *int) func() time.Time

func RespondWithError

func RespondWithError(w http.ResponseWriter, code int, message string)

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})

func SleepLog

func SleepLog(msg string, totalDuration time.Duration)

func SliceAtoi added in v1.0.26

func SliceAtoi(sa []string) ([]int, error)

func SplitToString added in v1.0.25

func SplitToString(a []int, sep string) string

func TimeDiff added in v1.0.21

func TimeDiff(TimeA time.Time, TimeB time.Time) time.Time

Types

This section is empty.

Jump to

Keyboard shortcuts

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