basesvc

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

View Source
const Delim = "."

Variables

This section is empty.

Functions

func Component

func Component[T any](name string, set configset.Set[T], opts ...fx.Option) fx.Option

func DBFxOpt

func DBFxOpt() fx.Option

func GetConfig

func GetConfig[T any](c *Config, path string, def T) (*T, error)

GetConfig returns the unmarshalled configuration in `path`. If `path` does not exist, `def` is returned. Unmarshalling is done into a prepopulated config with `def`.

func HookOnStart

func HookOnStart(lc fx.Lifecycle, f func(context.Context) error)

func HookOnStop

func HookOnStop(lc fx.Lifecycle, f func(context.Context) error)

func HookSimpleOnStart

func HookSimpleOnStart(lc fx.Lifecycle, f func())

func HookSimpleOnStop added in v0.4.3

func HookSimpleOnStop(lc fx.Lifecycle, f func())

func LoggerFxOpt

func LoggerFxOpt() fx.Option

func NewCommonOpts

func NewCommonOpts(cfg *Config, ropts RunOptions) []fx.Option

func SetFXRunOpts

func SetFXRunOpts(opts RunOptions)

func StartDB

func StartDB(ctx context.Context, cfg *Config) (db.DB, error)

Types

type Config

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

TODO: need to find a way to list all expected keys.

func LoadConfig

func LoadConfig(envVarPrefix string, confmapvs map[string]any, yamlPath string) (*Config, error)

TODO: make sure confmapvs maps to real pre-registered keys. If envVarPrefix is empty, do not load from environment. If yamlPath is empty, do not load from file.

func (*Config) Get

func (c *Config) Get(path string, dst any) (bool, error)

func (*Config) ListAll

func (c *Config) ListAll() []string

func (*Config) Store

func (c *Config) Store(name string, config any)

type RunOptions

type RunOptions struct {
	Mode           configset.Mode
	Silent         bool          // No logs at all
	TemporalClient client.Client // use this instead of creating a new temporal client.
}

Jump to

Keyboard shortcuts

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