appconfig

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	BaseSubject events.Subject = "appconfig"

	UpdateSubject events.Type = "update"
)

Variables

View Source
var Module = fx.Module("appconfig",
	fx.Provide(
		New,
	),
)
View Source
var TestModule = fx.Module("appconfig_test",
	fx.Provide(
		NewTest,
	),
)

Functions

This section is empty.

Types

type Cfg

type Cfg = rector.AppConfig

type Config

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

func (*Config) Get

func (c *Config) Get() *Cfg

func (*Config) Reload

func (c *Config) Reload(ctx context.Context) (*Cfg, error)

func (*Config) Set

func (c *Config) Set(val *Cfg)

func (*Config) Subscribe

func (c *Config) Subscribe() chan *Cfg

func (*Config) Unsubscribe

func (c *Config) Unsubscribe(ch chan *Cfg)

func (*Config) Update

func (c *Config) Update(ctx context.Context, val *Cfg) error

type IConfig

type IConfig interface {
	Get() *Cfg
	Set(val *Cfg)
	Update(ctx context.Context, val *Cfg) error
	Reload(ctx context.Context) (*Cfg, error)

	Subscribe() chan *Cfg
	Unsubscribe(ch chan *Cfg)
}

func New

func New(p Params) (IConfig, error)

func NewTest

func NewTest(p TestParams) (IConfig, error)

type Params

type Params struct {
	fx.In

	LC fx.Lifecycle

	Logger *zap.Logger
	JS     *events.JSWrapper
	DB     *sql.DB
}

type TestConfig

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

func (*TestConfig) Get

func (c *TestConfig) Get() *Cfg

func (*TestConfig) Reload

func (c *TestConfig) Reload(ctx context.Context) (*Cfg, error)

func (*TestConfig) Set

func (c *TestConfig) Set(val *Cfg)

func (*TestConfig) Subscribe

func (c *TestConfig) Subscribe() chan *Cfg

func (*TestConfig) Unsubscribe

func (c *TestConfig) Unsubscribe(ch chan *Cfg)

func (*TestConfig) Update

func (c *TestConfig) Update(ctx context.Context, val *Cfg) error

type TestParams

type TestParams struct {
	fx.In

	LC fx.Lifecycle
}

Jump to

Keyboard shortcuts

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