sap_segmentation

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImportSegments

func ImportSegments(log *log.Logger, loader Loader, storer Storer)

func NewLogger

func NewLogger(maxAge time.Duration) (*log.Logger, error)

Types

type Config

type Config struct {
	StorerArgs DbConnection
	LoaderArgs ConnArgs
	Log        Logger
}

func LoadConfig

func LoadConfig() (*Config, error)

type ConnArgs

type ConnArgs struct {
	Uri             string        `default:"http://bsm.api.iql.ru/ords/bsm/segmentation/get_segmentation"`
	AuthLoginPwd    string        `default:"4Dfddf5:jKlljHGH" split_words:"true"`
	UserAgent       string        `default:"spacecount-test" split_words:"true"`
	ConnectTimeout  time.Duration `default:"5s" envconfig:"CONN_TIMEOUT"`
	Interval        time.Duration `default:"1500ms"`
	ImportBatchSize int           `default:"50" envconfig:"IMPORT_BATCH_SIZE"`
}

type DbConnection

type DbConnection struct {
	Host     string `default:"127.0.0.1"`
	Port     int    `default:"5432"`
	DbName   string `default:"mesh_group" envconfig:"DB_NAME"`
	User     string `default:"postgres"`
	Password string `default:"postgres"`
}

type HTTPLoader

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

func NewHTTPLoader

func NewHTTPLoader(
	log *log.Logger,
	args *ConnArgs) (*HTTPLoader, error)

func (*HTTPLoader) LoadNext

func (hi *HTTPLoader) LoadNext() ([]model.Segmentation, error)

type Loader

type Loader interface {
	LoadNext() ([]model.Segmentation, error)
}

type Logger

type Logger struct {
	CleanupMaxAgeDays int `default:"7" envconfig:"LOG_CLEANUP_MAX_AGE"`
}

type PGStorer

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

func NewPGStorer

func NewPGStorer(cfg *DbConnection) (*PGStorer, error)

func (*PGStorer) Store

func (s *PGStorer) Store(segs []model.Segmentation) error

type Storer

type Storer interface {
	Store(segs []model.Segmentation) error
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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