config

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package config implements the functions, types, and interfaces for the module.

Package config implements the functions, types, and interfaces for the module.

Package config implements the functions, types, and interfaces for the module.

Package config implements the functions, types, and interfaces for the module.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound defined error from kratos config package
	ErrNotFound = kratosconfig.ErrNotFound
)

Functions

This section is empty.

Types

type BuildFunc added in v0.1.16

type BuildFunc func(*configv1.SourceConfig, ...OptionSetting) (KConfig, error)

BuildFunc is a function type that takes a KConfig and a list of Options and returns a Selector and an error.

func (BuildFunc) NewConfig added in v0.1.16

func (fn BuildFunc) NewConfig(cfg *configv1.SourceConfig, ss ...OptionSetting) (KConfig, error)

NewConfig is a method that implements the ConfigBuilder interface for ConfigBuildFunc.

type Builder added in v0.1.16

type Builder interface {
	Factory
	// RegisterConfigBuilder registers a config builder with the given name.
	RegisterConfigBuilder(string, Factory)
}

Builder is an interface that defines a method for registering a config builder.

func NewBuilder added in v0.1.16

func NewBuilder() Builder

type Config

type Config struct {
	EnvPrefixes []string
	// contains filtered or unexported fields
}

func (*Config) GetEnv added in v0.1.15

func (c *Config) GetEnv(key string) (string, bool)

func (*Config) LoadFromFile added in v0.1.15

func (c *Config) LoadFromFile(path string, opts ...KOption) error

func (*Config) SetEnv added in v0.1.15

func (c *Config) SetEnv(key, value string)

func (*Config) Setup added in v0.1.15

func (c *Config) Setup(prefix string) error

type Configure added in v0.1.19

type Configure interface {
	FromConfig(cfg *configv1.SourceConfig) error
}

type Encoder

type Encoder func(v any) ([]byte, error)

Encoder is a function that takes a value and returns a byte slice and an error.

type EnvVars added in v0.1.15

type EnvVars struct {
	KeyValues map[string]string
}

func (*EnvVars) Get added in v0.1.15

func (v *EnvVars) Get(key string) (string, bool)

func (*EnvVars) Set added in v0.1.15

func (v *EnvVars) Set(key string, value string)

func (*EnvVars) Setup added in v0.1.15

func (v *EnvVars) Setup(prefix string) error

type Factory added in v0.1.16

type Factory interface {
	// NewConfig creates a new config using the given KConfig and a list of Options.
	NewConfig(*configv1.SourceConfig, ...OptionSetting) (KConfig, error)
}

Factory is an interface that defines a method for creating a new config.

type KConfig added in v0.1.18

type KConfig = kratosconfig.Config

Define types from kratos config package

func NewSourceConfig added in v0.1.17

func NewSourceConfig(opts ...KOption) KConfig

NewSourceConfig returns a new config instance

type KDecoder added in v0.1.18

type KDecoder = kratosconfig.Decoder

Define types from kratos config package

type KKeyValue added in v0.1.18

type KKeyValue = kratosconfig.KeyValue

Define types from kratos config package

type KMerge added in v0.1.18

type KMerge = kratosconfig.Merge

Define types from kratos config package

type KObserver added in v0.1.18

type KObserver = kratosconfig.Observer

Define types from kratos config package

type KOption added in v0.1.18

type KOption = kratosconfig.Option

Define types from kratos config package

func WithDecoder

func WithDecoder(d KDecoder) KOption

WithDecoder sets the decoder

func WithMergeFunc

func WithMergeFunc(m KMerge) KOption

WithMergeFunc sets the merge function

func WithResolveActualTypes

func WithResolveActualTypes(enableConvertToType bool) KOption

WithResolveActualTypes enables resolving actual types

func WithResolver

func WithResolver(r KResolver) KOption

WithResolver sets the resolver

func WithSource

func WithSource(s ...KSource) KOption

WithSource sets the source

type KReader added in v0.1.18

type KReader = kratosconfig.Reader

Define types from kratos config package

type KResolver added in v0.1.18

type KResolver = kratosconfig.Resolver

Define types from kratos config package

type KSource added in v0.1.18

type KSource = kratosconfig.Source

Define types from kratos config package

type KValue added in v0.1.18

type KValue = kratosconfig.Value

Define types from kratos config package

type KWatcher added in v0.1.18

type KWatcher = kratosconfig.Watcher

Define types from kratos config package

type Option

type Option struct {
	SourceOptions []KOption
	Decoder       KDecoder
	Encoder       Encoder
	Configure     Configure
}

type OptionSetting added in v0.1.17

type OptionSetting = func(s *Option)

OptionSetting is a function that takes a pointer to a KOption struct and modifies it.

func WithConfigure added in v0.1.19

func WithConfigure(cfg Configure) OptionSetting

func WithOptions

func WithOptions(options ...KOption) OptionSetting

WithOptions sets the options field of the KOption struct.

type Syncer added in v0.1.16

type Syncer interface {
	SyncConfig(*configv1.SourceConfig, any, ...OptionSetting) error
}

Syncer is an interface that defines a method for synchronizing a config.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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