config

package
v0.1.17 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) (SourceConfig, error)

BuildFunc is a function type that takes a SourceConfig 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) (SourceConfig, 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 ...SourceOption) 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 Decoder

type Decoder = kratosconfig.Decoder

Define types from kratos config package

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 SourceConfig and a list of Options.
	NewConfig(*configv1.SourceConfig, ...OptionSetting) (SourceConfig, error)
}

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

type KeyValue

type KeyValue = kratosconfig.KeyValue

Define types from kratos config package

type Merge

type Merge = kratosconfig.Merge

Define types from kratos config package

type Observer

type Observer = kratosconfig.Observer

Define types from kratos config package

type Option

type Option struct {
	SourceOptions []SourceOption
	Decoder       Decoder
	Encoder       Encoder
}

type OptionSetting added in v0.1.17

type OptionSetting = func(s *Option)

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

func WithOptions

func WithOptions(options ...SourceOption) OptionSetting

WithOptions sets the options field of the SourceOption struct.

type Reader

type Reader = kratosconfig.Reader

Define types from kratos config package

type Resolver

type Resolver = kratosconfig.Resolver

Define types from kratos config package

type Source

type Source = kratosconfig.Source

Define types from kratos config package

type SourceConfig added in v0.1.15

type SourceConfig = kratosconfig.Config

Define types from kratos config package

func NewSourceConfig added in v0.1.17

func NewSourceConfig(opts ...SourceOption) SourceConfig

NewSourceConfig returns a new config instance

type SourceOption

type SourceOption = kratosconfig.Option

Define types from kratos config package

func WithDecoder

func WithDecoder(d Decoder) SourceOption

WithDecoder sets the decoder

func WithMergeFunc

func WithMergeFunc(m Merge) SourceOption

WithMergeFunc sets the merge function

func WithResolveActualTypes

func WithResolveActualTypes(enableConvertToType bool) SourceOption

WithResolveActualTypes enables resolving actual types

func WithResolver

func WithResolver(r Resolver) SourceOption

WithResolver sets the resolver

func WithSource

func WithSource(s ...Source) SourceOption

WithSource sets the source

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.

type Value

type Value = kratosconfig.Value

Define types from kratos config package

type Watcher

type Watcher = kratosconfig.Watcher

Define types from kratos config package

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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