idmappers

package
v0.0.0-...-956ff96 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPIDMapper

func NewHTTPIDMapper(log *logrus.Logger, url string, timeout time.Duration) (*idmapper.IDMapper, error)

NewHTTPIDMapper creates IDMapper that reads data from http

func NewPgSQLIDMapper

func NewPgSQLIDMapper(log *logrus.Logger, db *sql.DB, query string) (*idmapper.IDMapper, error)

NewPgSQLIDMapper creates IDMapper that reads data from sql database

func NewRedisIDMapper

func NewRedisIDMapper(client *redis.Client, hashName string) (*idmapper.IDMapper, error)

NewRedisIDMapper creates IDMapper that reads data from redis

Types

type Config

type Config struct {
	Reloader struct {
		Currency struct {
			Interval      time.Duration `mapstructure:"interval"`
			RedisHashName string        `mapstructure:"redis_hash_name"`
		} `mapstructure:"currency"`
		Country struct {
			Interval time.Duration `mapstructure:"interval"`
		} `mapstructure:"country"`
		Language struct {
			Interval time.Duration `mapstructure:"interval"`
		} `mapstructure:"language"`
	} `mapstructure:"reloader"`
	Loader struct {
		Timeout time.Duration `mapstructure:"timeout"`
		URLs    struct {
			Currency string `mapstructure:"currency"`
			Country  string `mapstructure:"country"`
			Language string `mapstructure:"language"`
		} `mapstructure:"urls"`
	} `mapstructure:"loader"`
}

Config configuration of IDMappers

type IDMappers

type IDMappers struct {
	CurrencyCodes *idmapper.IDMapper
	CountryCodes  *idmapper.IDMapper
	LanguageCodes *idmapper.IDMapper
	// contains filtered or unexported fields
}

IDMappers consists of available IDMapper objects

func NewIDMappers

func NewIDMappers(log *logrus.Logger, client *redis.Client, db *sql.DB, config *Config) (*IDMappers, error)

NewIDMappers creates IDMappers with available IDMapper objects

func (*IDMappers) RunReloader

func (idMappers *IDMappers) RunReloader(log *logrus.Logger)

RunReloader starts scheduler for automatic reloading of IDMapper objects

func (*IDMappers) StopReloader

func (idMappers *IDMappers) StopReloader()

StopReloader stops scheduler for automatic reloading of IDMapper objects

Jump to

Keyboard shortcuts

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