config_injection

package
v0.0.0-...-de70ca6 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Usage

func Usage()

Types

type Cache

type Cache interface {
	Store(key string, data []byte)
	Get(key string) ([]byte, error)
}

Cache will store/retrieve data in a fast way

type FetcherConfig

type FetcherConfig interface {
	Logger() Logger
	Instrumentation() Instrumentation
}

type Instrumentation

type Instrumentation interface {
	Count(key string, value int)
	Duration(key string, start time.Time)
}

Instrumentation records the performances and events

type Logger

type Logger interface {
	Error(message string, args ...interface{})
	Warn(message string, args ...interface{})
	Info(message string, args ...interface{})
	Debug(message string, args ...interface{})
}

Logger logs stuff

type MyConfig

type MyConfig interface {
	Logger() Logger
	Instrumentation() Instrumentation
	Timeout() time.Duration
	Workers() int
}

MyConfig defines the config for MyStruct

type MyObject

type MyObject struct{}

func NewFetcher

func NewFetcher(cfg FetcherConfig, url string, timeout time.Duration) *MyObject

type MyStruct

type MyStruct struct {
}

MyStruct does something fantastic

func NewByConfigConstructor

func NewByConfigConstructor(cfg MyConfig, limiter RateLimiter, cache Cache) *MyStruct

NewByConfigConstructor is the constructor for MyStruct

func NewLongConstructor

func NewLongConstructor(logger Logger, stats Instrumentation, limiter RateLimiter, cache Cache, timeout time.Duration, workers int) *MyStruct

NewLongConstructor is the constructor for MyStruct

type RateLimiter

type RateLimiter interface {
	Acquire()
	Release()
}

RateLimiter limits how many concurrent requests we can make or process

Jump to

Keyboard shortcuts

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