utils

package
v0.0.0-...-b42f91c Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultTimeout = 30 * time.Second
	DefaultRetries = 0
	DefaultBackoff = 3 * time.Second
)
View Source
var DefaultLogger, _ = GetLoggerFromLvl(zap.InfoLevel)

DefaultLogger is the default logger among all project with level="INFO"

Functions

func GetLoggerFromLvl

func GetLoggerFromLvl(loglvl zapcore.Level, opts ...zap.Option) (*zap.Logger, error)

GetLoggerFromLvl gets logger with (zapcore.Level)

func GetLoggerFromLvlString

func GetLoggerFromLvlString(loglvl string, opts ...zap.Option) (*zap.Logger, error)

GetLoggerFromLvlString gets logger with log level string. E.g, "info", "warn", ...

Types

type ClientOption

type ClientOption func(*Getter) error

func Backoff

func Backoff(backoff time.Duration) ClientOption

func Retries

func Retries(times int) ClientOption

func Timeout

func Timeout(timeout time.Duration) ClientOption

type Getter

type Getter struct {
	// contains filtered or unexported fields
}

Getter utilize go-getter package to download the files (only support download file so far)

func NewGetter

func NewGetter(opts ...ClientOption) (*Getter, error)

NewGetter initializes Getter client, default only http getter

func (Getter) Get

func (gc Getter) Get(ctx context.Context, src, dst string) error

Jump to

Keyboard shortcuts

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