cli

package
v0.2.9-rc Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PaginationSizeDefault, PaginationPageDefault int32

Functions

func Display added in v0.1.24

func Display(cmd *cobra.Command, v any, prettyFormatter FormatFn) error

Display formats the given value 'v' using format specified as value for --format flag and writes to STDOUT. If --format=pretty/human, custom-formatter passed will be used.

func Execute

func Execute(ctx context.Context)

func GoFormat added in v0.1.24

func GoFormat(w io.Writer, v any) error

GoFormat outputs 'v' formatted using pp package.

func JSONFormat added in v0.1.24

func JSONFormat(w io.Writer, v any) error

JSONFormat outputs 'v' formatted as indented JSON.

func StartServer added in v0.1.26

func StartServer(ctx context.Context, cfg Config, migrate, spawnWorker bool) error

func StartWorkers added in v0.1.26

func StartWorkers(ctx context.Context, cfg Config) error

func TOMLFormat added in v0.1.24

func TOMLFormat(w io.Writer, v any) error

TOMLFormat outputs 'v' formatted as per TOML spec.

func YAMLFormat added in v0.1.24

func YAMLFormat(w io.Writer, v any) error

YAMLFormat outputs 'v' formatted as per YAML spec.

Types

type Config

type Config struct {
	Log       logger.LogConfig `mapstructure:"log"`
	Syncer    SyncerConf       `mapstructure:"syncer"`
	Service   ServeConfig      `mapstructure:"service"`
	PGConnStr string           `mapstructure:"pg_conn_str" default:"postgres://postgres@localhost:5432/entropy?sslmode=disable"`
	Telemetry telemetry.Config `mapstructure:"telemetry"`
}

Config contains the application configuration.

type FormatFn added in v0.1.24

type FormatFn func(w io.Writer, v any) error

type RunEFunc

type RunEFunc func(cmd *cobra.Command, args []string) error

type ServeConfig added in v0.1.26

type ServeConfig struct {
	Host string `mapstructure:"host" default:""`
	Port int    `mapstructure:"port" default:"8080"`

	HTTPAddr              string `mapstructure:"http_addr" default:":8081"`
	PaginationSizeDefault int32  `mapstructure:"pagination_size_default" default:"0"`
	PaginationPageDefault int32  `mapstructure:"pagination_page_default" default:"1"`
}

type SyncerConf added in v0.1.26

type SyncerConf struct {
	SyncInterval        time.Duration           `mapstructure:"sync_interval" default:"1s"`
	RefreshInterval     time.Duration           `mapstructure:"refresh_interval" default:"3s"`
	ExtendLockBy        time.Duration           `mapstructure:"extend_lock_by" default:"5s"`
	SyncBackoffInterval time.Duration           `mapstructure:"sync_backoff_interval" default:"5s"`
	MaxRetries          int                     `mapstructure:"max_retries" default:"5"`
	Workers             map[string]WorkerConfig `mapstructure:"workers" default:"[]"`
}

type WorkerConfig added in v0.1.26

type WorkerConfig struct {
	Count int                 `mapstructure:"count" default:"1"`
	Scope map[string][]string `mapstructure:"labels"`
}

Jump to

Keyboard shortcuts

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