utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2021 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const EPSILON float64 = 0.00000001

Variables

View Source
var TimeProfileEnabled bool

Functions

func EnvOrDefault

func EnvOrDefault(env string, defaultVal string) string

func ExtractFile

func ExtractFile(fs afero.Fs, absPath string, targetFs afero.Fs, targetPath string, exchangeName string, fileType constants.FileType, refTime time.Time) (string, error)

func FloatEquals

func FloatEquals(a, b float64) bool

func FormatDuration

func FormatDuration(d time.Duration) string

func GetExchPairLogger

func GetExchPairLogger(ex common.Exchange, pair common.Pair) zerolog.Logger

func GogoProtoTsToTime

func GogoProtoTsToTime(ts *types.Timestamp) time.Time

func GogoProtoTsToTimePtr

func GogoProtoTsToTimePtr(ts *types.Timestamp) *time.Time

func GunzipWrite

func GunzipWrite(w io.Writer, r io.Reader) error

func JoinErrs

func JoinErrs(errs ...error) error

func JoinErrsS

func JoinErrsS(errs ...string) error

func MakeExitChan

func MakeExitChan() chan os.Signal

func ProtoTsToTime

func ProtoTsToTime(ts *timestamp.Timestamp) time.Time

func ProtoTsToTimePtr

func ProtoTsToTimePtr(ts *timestamp.Timestamp) *time.Time

func TimeProfile

func TimeProfile(name string, fn func())

func TimePtrToProtoTsPtr

func TimePtrToProtoTsPtr(t *time.Time) *timestamp.Timestamp

func TimeToGogoProtoTs

func TimeToGogoProtoTs(ts *time.Time) types.Timestamp

func TimeToGogoProtoTsPtr

func TimeToGogoProtoTsPtr(ts *time.Time) *types.Timestamp

func TimeToProtoTsPtr

func TimeToProtoTsPtr(t time.Time) *timestamp.Timestamp

func UnmarshalResponse

func UnmarshalResponse(resp *http.Response, out interface{}) error

Types

type TimeRange

type TimeRange struct {
	Start time.Time
	End   time.Time
}

func NewTimeRange

func NewTimeRange(start time.Time, end time.Time) TimeRange

Jump to

Keyboard shortcuts

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